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,880 points

edited Dec 19, 2018 by Sushmita 62 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,050 points

edited Dec 19, 2018 by Daisy

Related Questions In Java

+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,380 points

edited Nov 6, 2018 by Omkar 9,081 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 in Java by Sirajul
• 29,940 points
164 views
0 votes
2 answers

How do I get the current date and time using Java?

If you require a time stamp in ...READ MORE

answered Aug 23 in Java by Sirajul
• 29,940 points
93 views
0 votes
1 answer

How to print java array in the simplest way?

String[] arr = new String[] {"John", "Mary", ...READ MORE

answered Apr 17, 2018 in Java by sophia
• 1,400 points
78 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,090 points
752 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,130 points
998 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,130 points
710 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,050 points
613 views