How do i wait for a specific frame to load? I'm using selenium webdriver 2.24

后端 未结 2 642
时光说笑
时光说笑 2020-12-20 12:36

I used the webdriver backed selenium to wait for a specific frame to load. since in certain cases the switching to a specific frame fails because the frame hasn\'t loaded. T

相关标签:
2条回答
  • 2020-12-20 13:18

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

    0 讨论(0)
  • 2020-12-20 13:22

    You can use Web Driver Wait and Expected Condition class to achieve this.

    Try this code.

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

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

    The time limit depends upon the application and user wish.

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

    0 讨论(0)
提交回复
热议问题