I want to get exception of page load, but still have not results on it. I use implicitlyWait to set timer to throw exception.
WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(1, TimeUnit.MILLISECONDS);
driver.get("http://www.rambler.ru");
driver.quit();
Could somebody please update me with suggestions? I need this to make sure that page load will not be infinite, and if time to load will be more than I've defined in timer -> throw exception as result and skip TC (as failed).
Thank you, Volodymyr
Why are you using implicit wait before the opening of the page? Try to use explicit wait. Find some major page element at ramber(for example, the search textbox). For example:
WebDriverWait wait = new WebDriverWait(webDriver, 5);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("xpath_to_search_textbox")));
until() method will throw TimeoutException if search text box will not appear within 5 seconds.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With