Issue
Here is the snippet from the new Selenium doc on Waits:
WebDriver driver = new ChromeDriver();
driver.get("https://google.com/ncr");
driver.findElement(By.name("q")).sendKeys("cheese" + Keys.ENTER);
// Initialize and wait till element(link) became clickable - timeout in 10 seconds
WebElement firstResult = new WebDriverWait(driver, Duration.ofSeconds(10))
.until(ExpectedConditions.elementToBeClickable(By.xpath("//a/h3")));
When I paste this code, it gives me an error on the Duration: The constructor WebDriverWait(WebDriver, Duration) is undefined
It still works with the following syntax:
WebElement firstResult = new WebDriverWait(driver, 10)
.until(ExpectedConditions.elementToBeClickable(By.xpath("//a/h3")));
Is it the documentation bug?
Solution
As I wrote in the original question,
WebElement firstResult = new WebDriverWait(driver, 10)
.until(ExpectedConditions.elementToBeClickable(By.xpath("//a/h3")));
the code above still works. I guess, as @Fenio assumed, the new syntax will be available in Selenium 4 since it exists in the GitHub.
Answered By - Vladimir
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.