0

Going through the Webdriver Timeouts I noticed that for setScriptTimeout, if I type

WebDriver driver = new FirefoxDriver(); 
driver.manage().timeouts().setScriptTimeout(5, TimeUnit.SECONDS);

I cannot see the method to select for "executeAsyncScript" when I type "driver." (driver dot)

But if I type:

FirefoxDriver driver = new FirefoxDriver();
driver.manage().timeouts().setScriptTimeout(5, TimeUnit.SECONDS);

I can see the method for "executeAsyncScript" and so I can type

driver.executeAsyncScript("", args);

What is the reason for this?

2

As you can see in the Javadoc, the method executeAsyncScript is inherited from the class RemoteWebDriver, while the interface WebDriver has no such method.

Because you declare your variable as a WebDriver object you cannot call its subclass methods.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.