Java – selenium. In selenium webdriver What is the equivalent of waitforpagetoload (“30000”)?

The following is the Java code waiting for the page to load in selenium RC:

selenium.waitForPageToLoad("30000");

What is the equivalent java code in selenium webdriver?

Solution

2 methods:

>If you need to wait 60 seconds, you can use thread Sleep (60000) > if you want to ensure that the page is loaded (possibly less than or greater than 60 seconds), I recommend the following method:

Identify the element in the target page & wait for it to click Then you make sure that the page is loaded

webdriverwait wait = new webdriverwait(driver,120);
wait.until(ExpectedConditions.elementToBeClickable(By.id(id)));

Webdriver waits up to 120 seconds For clickable elements If the element can be clicked before this, the test will proceed

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>