Synchronization in Selenium in ruby
We have 2 types of synchronization points in Selenium Ruby.- Implicit timeouts – Applies to all elements
- Explicit timeouts – Applies to specific element
Implicit Timeout
Syntax is given below
driver.manage.timeouts.implicit_wait = 20
Selenium ruby script will wait for 20 seconds for element to exist on the web page. If element is not found until 20 seconds, element not found exception is thrown.Explicit Timeout
wait = Selenium::WebDriver::Wait.new(:timeout => 12)
wait.until { driver.find_element(:id => “productid”) }
Above code will wait for element with id – productid to appear for 12 seconds.Web development and Automation testing
solutions delivered!!