I'm using Thread.sleep(310),means waiting for 5 minutes in my script level.
I don't have any other option,as per my application i need to wait 5 minutes then need to refresh() ,then only i will get certain text on my page that text i need to verify.
Currently i'm using like this Thread.sleep(310);driver.refresh();
While waiting for 5 minutes my selenium script is getting closed and getting error as session lost.
答案 0 :(得分:0)
将WebdriverWait与自定义的ExpectedConditions一起使用。例如:
WebDriverWait wait = new WebDriverWait(driver, 300);
wait.until(ExpectedConditions.titleIs("Title")); // if your title same
wait.until(ExpectedConditions.visibilityOf(%your_web_element%)); // if you have element that shouldn't change during this time