Unable to execute any JavaScript using "executescript" during functional tests in IE, while it works perfectly with Firefox. Despite hours of searching on Google, I haven't been able to find a solution.
Here is an example of how I am trying to call it:
browser.driver.executeScript("console.log('test');")
or
JavascriptExecutor js = (JavascriptExecutor) driver
driver.executeScript("console.log('test');")
with different variations of the executeScript method as well.
The stack trace error message received is:
org.openqa.selenium.WebDriverException: JavaScript error (WARNING:
The server did not provide any stacktrace information)
Command duration or timeout: 164 milliseconds
Build info: version: '2.37.1', revision: 'a7c61cbd68657e133ae96672cf995890bad2ee42',
time: '2013-10-21 09:08:07'
System info: host: 'functionalTests', ip: '10.22.6.112', os.name: 'Windows 8', os.arch:
'x86', os.version: '6.2', java.version: '1.6.0_45'
Session ID: 8b04c740-07a0-4678-a1b6-aacd56268625
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{platform=WINDOWS, javascriptEnabled=true, elementScrollBehavior=0,
enablePersistentHover=true, ignoreZoomSetting=false, ie.ensureCleanSession=false,
browserName=internet explorer, enableElementCacheCleanup=true,
unexpectedAlertBehaviour=dismiss, version=11, ie.usePerProcessProxy=false,
cssSelectorsEnabled=true, ignoreProtectedModeSettings=false, requireWindowFocus=false,
initialBrowserUrl=http://localhost:17553/, handlesAlerts=true,
ie.forceCreateProcessApi=false, nativeEvents=true, browserAttachTimeout=0,
ie.browserCommandLineSwitches=, takesScreenshot=true}]
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
at
org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:463)
at functional.utility.JQInstaller.installJQ(JQInstaller.groovy:16)
at functional.spec.NavigateAccountSettingsSpec.Navigate to the Account
Settings(NavigateAccountSettingsSpec.groovy:39)
The issue seems to be specifically with the "executeScript" method rather than with my "JQInstaller" class, as even simple console.log functions fail to work. Using Selenium 2.37.1.