I have a CustomWebDriver class that extends the functionality of JavascriptExecutor. Here is my implementation:
@Override
public Object executeScript(String script, Object... args) {
return ((JavascriptExecutor) driver).executeScript(script, args);
}
However, when I try to use this code snippet below, I encounter an error:
Argument is of an illegal type: driverFactory.CustomWebElement
WebElement testElmtBy = returnSearchLists().get(i);
WebDriver vDriver = driver.get();
((JavascriptExecutor)vDriver).executeScript("arguments[0].scrollIntoView(true);", testElmtBy);
The method returnSearchLists().get(i)
returns an object of type CustomWebElement
, which contains a public element iElement
.
Even though I declared testElmtBy as a WebElement, it is still being recognized as a CustomWebElement.
Am I missing something in my code?