Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7760889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:00:39+00:00 2026-06-01T14:00:39+00:00

So I always written scripts using perl but making an attempt with Ruby, so

  • 0

So I always written scripts using perl
but making an attempt with Ruby, so this question may sound real silly but ill make a go.

I am writing Selenium Webdriver scripts in ruby Test::Unit
Below is some sample code.

 def test_runit
    @driver.get(@base_url + "/")
    @driver.find_element(:id, "gbqfq").clear
    @driver.find_element(:id, "gbqfq").send_keys "selenium"
    @driver.find_element(:id, "gbqfb").click
    @driver.find_element(:link, "Selenium - Web Browser Automation").click
    assert(@driver.find_element(:tag_name => "body").text.include?("administration tasks"),"the assert works")
    @driver.find_element(:link, "Support").click
  end

With an output

 ruby runit.rb 
Loaded suite runit
Started
.
Finished in 9.732149 seconds.

1 tests, 2 assertions, 0 failures, 0 errors

While testing I need to check if text is present on the page.
Using assert works just fine.
But if it fails the test ends there and there and does not proceed any further.

In perl I could you some thing like verify which basically marks something as failed and proceed ahead.

I am hoping to get a result like this

ruby runit.rb 
Loaded suite runit
Started
.
Finished in 9.732149 seconds.

1 tests, 1 assertion, 1 failure, 0 errors

But verify does not work for ruby test Unit or may be i am doing it wrong.

Can some one point me to some sample code?
thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T14:00:41+00:00Added an answer on June 1, 2026 at 2:00 pm

    Got it!!
    One would need to use rescue.
    thanks for responding back.

    begin
        assert(@driver.find_element(:tag_name => "body").text.include?("text to check"),"the assert works")
    rescue Test::Unit::AssertionFailedError
        @verification_errors << $!
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have always written regexes like this <A HREF=([^]*) TARGET=_blank>([^<]*)</A> but I just learned
I have always written my boolean expressions like this: if (!isValid) { // code
Traditionally I have always written my sql scripts by hand so they are nice
This question sort of covers both ServerFault.com and here, but this seems more programming
Do any queries exist that require RIGHT JOIN, or can they always be re-written
Previously I've written some very simple multithreaded code, and I've always been aware that
I always believe they did, but seeing some answers here make me doubt... Can
I always tend to forget these built-in Symfony functions for making links.
I have a script that's written in perl, and executed as CGI. It works
I have written php script for user login but instead of displaying the result

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.