How to wait for a specific frame to load? I am using selenium webdriver 2.24

I used a webdriver that supported selenium to wait for a specific frame to load. since in some cases switching to a specific frame fails because the frame is not loaded. The code I'm using is

selenium.waitForFrameToLoad(frameJCLeft, strTimeOut); driver.switchTo().defaultContent(); driver.switchTo().frame(frameJCLeft); 

Please let me know if there is a method that I plan to exclude from selenium backed webdriver and use only webdriver api

+6
source share
2 answers

You can use the Web Driver Wait and Expected Condition class for this.

Try this code.

  WebDriverWait wait = new WebDriverWait(driver,10); wait.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(frameName); 

The above code will wait for given frame up to 10 seconds . If a frame is available, it switches to that frame. Otherwise, it throws a TimeoutException .

The time limit depends on the wishes of the application and the user.

For more information http://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/selenium/support/ui/ExpectedConditions.html#frameToBeAvailableAndSwitchToIt(java.lang.String)

+21
source

I would switch to using Selenium 2 and use RemoteWebDriver instead of "WebDriver backed selenium 1.0 stuff". Then I will play with WebDriver.TargetLocator .

0
source

All Articles