Selenium Web driver wait for long time

落花浮王杯 提交于 2019-12-03 16:27:17

Considering you need to wait for a particular element i'd do something in the lines of a ExplicitWait like below.

WebDriverWait wait = new WebDriverWait(driver, 300); // The int here is the maximum time in seconds the element can wait.
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("someId")));

On this case you can use any of the ExpectedConditions you'd like. Also not having to use a big wait time on some very particular cases. This imho is a good practice.

Actually this is not my answer, Two days ago I saw this answer here, But I had no time to apply it.Today I tried it and that's what exact I wanted.

Unfortunately Now I can not see that answer here.So I added this answer and all credits should go to the user who posted this answer here.

In this case what I wanted to do is to wait the driver for 5 mins so that until execute the periodical cron job.

Thread.sleep(4000); to pause execution of program.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!