Below is my code which is showing as deprecated after I have been updated the Selenium Webdriver version to 3.11.0.
private Wait<WebDriver> mFluentWait(WebDriver pDriver) {
Wait<WebDriver> gWait = new FluentWait<WebDriver>(pDriver).withTimeout(100, TimeUnit.SECONDS)
.pollingEvery(600, TimeUnit.MILLISECONDS).ignoring(NoSuchElementException.class);
return gWait;
}
Showing deprecated warning in withTimeout
and pollingEvery
section in the code.
How can I rewrite this code so that I can remove the deprecated warning.
Since am new to selenium am not sure about the change. Any help will be appreciated.
1. implicitlyWait() This timeout is used to specify the amount of time the driver should wait while searching for an element if it is not immediately present.
You should try to increase the timeout to ensure that the objects are available to selenium to work. If you want to handle the error, better include this code in @BeforeTest or @BeforeSuite annotation which ensure the entire test suite will not run if this fails.
In Selenium, TimeOut exception occurs when a command takes longer than the wait time to avoid the ElementNotVisible Exception. If the commands do not complete even after the wait time is over, a TimeOut Exception is thrown.
selenium. internal package, is deprecated in Selenium 4. The changes are internal to the Selenium framework. Therefore, Selenium users can continue using the FindElement(By) and FindElements(By) as used in Selenium 3.
Check the source code of FluentWait which mentions to use the methods using Duration as arguments instead.
withTimeout(Duration duration)
method.pollingEvery(Duration duration)
method.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With