I am new in Selenium. I am using Selenium WebDriver with Java. I'm using eclipse as IDE. I have written some code for Login page and it is run successfully. Now I want to go to desired page after successful login, but I want to wait for few time before transiting another page. How can I wait a page before loading another page?
As far as I know, there are 3 ways:
Implicit wait: (It's applicable for all elements on the page)
driver.manage().timeouts().implicitlyWait(A_GIVEN_NUMBER, TimeUnit.SECONDS);
Explicit wait: (Applicable for a particular element)
WebDriverWait.until(CONDITION_THAT_FINDS_AN_ELEMENT);
More specific code is as below:
WebDriverWait wait = new WebDriverWait(driver, 40);
WebElement element = wait.until(ExpectedConditions.elementToBeClickable(By.id("someid")));
Using Thread:
Thread.sleep(NUMBER_OF_MILLIS);
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