1

Is there any way to catch all timeout error events in selenium , written in Ruby?

I am writing jenkins with selenium , but not sure the best way to terminate building tasks btw steps . The way I found so far is to put exec("exit 1") inside ruby file. However, I have no idea when to put this command . So , I'd like to catch all timeout error and trigger this event.

If there's any better way , please kindly advise ! Thanks!

1
  • Is it for selenium-webdriver? Commented Mar 27, 2013 at 11:40

1 Answer 1

2

Here is some hints to your problem:

begin

    wait = Selenium::WebDriver::Wait.new(:timeout => 10) # seconds
    wait.until { driver.title.include? "page title" }
    driver.find_element(:xpath, ".//*[@id='subTabHeaders']/div[3]")}.click

rescue Selenium::WebDriver::Error::TimeOutError

    exit(1)

end
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.