Not able to user WebDriverWait class

27 Views Asked by At

I am new to Java with Selenium and I am not being able to use WebDriverWait class.

I have added dependencies for selenium and webdriver manager and also imported the class on the java class but still I am getting: WebDriverWait is undefined.

ERROR

I tried to import the class manually and also tried to change dependencies on the pom.xml file / also updated the project after every change but its not working.

1

There are 1 best solutions below

0
Shawn On

From Selenium 4 and onwards, you should create an object of WebDriverWait as below:

WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));

Imports:

import java.time.Duration;
import org.openqa.selenium.support.ui.WebDriverWait;

Reference: Class WebDriverWait