Please anyone explain with an example how Implicit wait can be used in Selenium Webdriver?

+1 vote
Please anyone explain with an example how Implicit wait can be used in Selenium Webdriver?
Jul 22, 2019 in Selenium by Kartik
192 views

2 answers to this question.

+1 vote

Hello Kartik, following piece of code can help you in understanding Implicit wait and how it can be used in Selenium:

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

import org.testng.annotations.Test;

public class VerifyTitle

{

                @Test

                public void verifyPageTitle()

                {

                                WebDriver driver=new FirefoxDriver();

                                driver.manage().window().maximize();

                                driver.get("http://www.facebook.com");

                                // Specify implicit wait of 30 seconds                                   
                                 driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

                              // No login id is present on Webpage so this will fail our script.
                                driver.findElement(By.id("login")).sendKeys(" Abha Rathour");

                }

}
answered Jul 22, 2019 by Abha
• 27,930 points
+1 vote
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
answered Dec 24, 2019 by Sandy
Thanks @Sandy

This one line was all I needed.
hello @Sandy! I hope you are doing fine. Please do register at Edureka Community and earn credits for all your contribution(asking a question, answering, commenting or even upvoting)

Related Questions In Selenium

0 votes
1 answer

Can anyone explain how an AJAX call can be handled in Selenium webdriver?

Hello Megha, to demonstrate how AJAX calls are ...READ MORE

answered May 8, 2019 in Selenium by Pratibha
• 3,690 points
312 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Impilicit wait vs Explicit wait vs Fluent wait

Implicit wait: Your telling the WebDriver the ...READ MORE

answered Apr 13, 2018 in Selenium by king_kenny
• 3,710 points
1,593 views
0 votes
1 answer

Implicit wait & Explicit wait in selenium WebDriver

Implicit Wait:  While loading a web page in ...READ MORE

answered May 24, 2018 in Selenium by Meci Matt
• 9,460 points
469 views
+1 vote
3 answers

Need to wait until page is completely loaded - Selenium WebDriver

You can try something like -  new WebDriverWait(firefoxDriver, ...READ MORE

answered Dec 20, 2019 in Selenium by Robin
20,701 views
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,510 points
3,130 views
0 votes
2 answers

Can anyone help me that how to run Selenium WebDriver test cases in Chrome?

You first need to download chrome driver ...READ MORE

answered Aug 26, 2019 in Selenium by Abha
• 27,930 points
642 views
0 votes
1 answer

How can we read data from an excel sheet in Selenium webdriver?

Hi Tarun, to read data from an ...READ MORE

answered May 8, 2019 in Selenium by Abha
• 27,930 points
10,853 views