How do I ask the Selenium-WebDriver to wait for few seconds in Java?

+2 votes
I want to add a delay of few seconds in the Selenium WebDriver. How can I do that?
Dec 19, 2018 in Java by Sushmita
• 6,890 points

edited Dec 19, 2018 by Sushmita 105 views

1 answer to this question.

0 votes

There are two ways to wait: explicit and implicit wait. 

The idea of explicit wait is

WebDriverWait.until(condition-that-finds-the-element);

The idea of implicit wait is

driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
fluentWait function returns your found web element.

answered Dec 19, 2018 by Daisy
• 8,090 points

edited Dec 19, 2018 by Daisy

Related Questions In Java

0 votes
1 answer

if i given invalid data how to get alert in selenium using java

Hello, Here is some of the method you ...READ MORE

answered Jul 20 in Java by Niroj
• 44,520 points
48 views
0 votes
1 answer

How do I convert a String to an int in Java?

Hello @kartik, We can use the parseInt(String str) method of ...READ MORE

answered Jul 28 in Java by Niroj
• 44,520 points
25 views
+5 votes
3 answers

How to execute a python file with few arguments in java?

You can use Java Runtime.exec() to run python script, ...READ MORE

answered Mar 27, 2018 in Java by DragonLord999
• 8,420 points

edited Nov 6, 2018 by Omkar 26,958 views
0 votes
2 answers

How can I convert a String variable to a primitive int in Java

 Here are two ways illustrating this: Integer x ...READ MORE

answered Aug 20, 2019 in Java by Sirajul
• 55,530 points
450 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,150 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,890 points
2,368 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,890 points
2,520 views
0 votes
2 answers
0 votes
2 answers

What is the use of toString method in Java and how can I use it ?

Whenever you require to explore the constructor ...READ MORE

answered Aug 23, 2018 in Java by Daisy
• 8,090 points
1,415 views