Skip to main content
added 10 characters in body
Source Link
Michael Durrant
  • 25.2k
  • 3
  • 41
  • 113

I recommend you switch from ImplicitlyWait to Explicitly wait for the element you want as detailed at http://www.seleniumhq.org/docs/04_webdriver_advanced.jsp

Example:

require 'rubygems' # not required for ruby 1.9 or if you installed without gem
requireWebDriver 'selenium-webdriver'

driver = Selenium::WebDriver.fornew :firefoxFirefoxDriver();
driver.get ("http://somedomain/url_that_delays_loading"
 );
waitWebElement myDynamicElement = Selenium::WebDriver::Wait.new(:timeoutnew =>WebDriverWait(driver, 10) # seconds
begin)
  element = wait.until { driver(ExpectedConditions.find_elementpresenceOfElementLocated(:By.id => "some-dynamic-element"("myDynamicElement") }
ensure
  driver.quit
end));

I recommend you switch from ImplicitlyWait to Explicitly wait for the element you want as detailed at http://www.seleniumhq.org/docs/04_webdriver_advanced.jsp

Example:

require 'rubygems' # not required for ruby 1.9 or if you installed without gem
require 'selenium-webdriver'

driver = Selenium::WebDriver.for :firefox
driver.get "http://somedomain/url_that_delays_loading"
 
wait = Selenium::WebDriver::Wait.new(:timeout => 10) # seconds
begin
  element = wait.until { driver.find_element(:id => "some-dynamic-element") }
ensure
  driver.quit
end

I recommend you switch from ImplicitlyWait to Explicitly wait for the element you want as detailed at http://www.seleniumhq.org/docs/04_webdriver_advanced.jsp

Example:

WebDriver driver = new FirefoxDriver();
driver.get("http://somedomain/url_that_delays_loading");
WebElement myDynamicElement = (new WebDriverWait(driver, 10))
  .until(ExpectedConditions.presenceOfElementLocated(By.id("myDynamicElement")));
Source Link
Michael Durrant
  • 25.2k
  • 3
  • 41
  • 113

I recommend you switch from ImplicitlyWait to Explicitly wait for the element you want as detailed at http://www.seleniumhq.org/docs/04_webdriver_advanced.jsp

Example:

require 'rubygems' # not required for ruby 1.9 or if you installed without gem
require 'selenium-webdriver'

driver = Selenium::WebDriver.for :firefox
driver.get "http://somedomain/url_that_delays_loading"

wait = Selenium::WebDriver::Wait.new(:timeout => 10) # seconds
begin
  element = wait.until { driver.find_element(:id => "some-dynamic-element") }
ensure
  driver.quit
end