TestProject Forum
Powered by leading experts in the test automation community

JavaScriptExecutor not working in Java

For some reason when I am trying to invoke Javascript code from selenium, nothing works for me.

JavaScriptExecutor jsExecutor = (JavaScriptExecutor) driver;
String result = ((Object) jsExecutor).executeScript("return window.innerHeight");

Selenium’s JavascriptExecutor should be with lowercase ‘s’.

What classes did you import ?

Found my error, thanks.

Imported gargoyle software’s javascriptexecuter by mistake