Los controladores selenium.getEval() y (JavascriptExecutor) fallan con SeleniumException esperando la evaluación.js en Firefox 17/19 (webdriver v2.32.0)

I get the below exception when i tried to execute JS code in firefox 17.0. v2.32 changelog mentions that it supports 10esr, 17esr, 19, 20. And I'm also aware that the latest webdriver version is 2.35 but due to locator issues with some tests I'm using v2.32. This works perfectly on chrome v29

Any idea on how to fix it? Thank you in advance

Aquí está el código:

public void commonWaitForAjax() throws Exception {
        for (int i=1; i<100; i++) {
      //    String status = selenium.getEval("$.active");   // fails here (legacy selenium method)
            String jsCode = "$.active";
            JavascriptExecutor js = (JavascriptExecutor) driver;
            printComment("executing: "+ jsCode);
            String status = (String) js.executeScript(jsCode); // fails here too (webdriver method)
            printComment("status: " + status);
            if( Integer.valueOf(status) == 0) {
                printComment("Ajax complete!!!");
                break;
            } else {
                printComment("Waiting for Ajax to complete...");
                Thread.sleep(1000);
            }
        }
    }

This is logged in console:

Sep 09, 2013 1:32:32 PM org.openqa.selenium.internal.seleniumemulation.WaitForPageToLoad handleSeleneseCommand
WARNING: Cannot determine whether page supports ready state. Abandoning wait.

Excepción

testMetersOverview(marklogic.test.MetersOverview)
com.thoughtworks.selenium.SeleniumException: waiting for evaluate.js load failed
Command duration or timeout: 10.26 seconds
Build info: version: '2.32.0', revision: '6c40c18', time: '2013-04-09 17:22:56'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_25'
Session ID: 5399e6a6-8134-4c08-b6d2-13716b8b96e2
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{platform=XP, databaseEnabled=true, cssSelectorsEnabled=true, javascriptEnabled=true, acceptSslCerts=true, handlesAlerts=true, browserName=firefox, browserConnectionEnabled=true, nativeEvents=true, webStorageEnabled=true, rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true, takesScreenshot=true, version=23.0.1}]
    at org.openqa.selenium.internal.seleniumemulation.SeleneseCommand.apply(SeleneseCommand.java:44)
    at org.openqa.selenium.internal.seleniumemulation.Timer.run(Timer.java:40)
    at org.openqa.selenium.WebDriverCommandProcessor.execute(WebDriverCommandProcessor.java:140)
    at org.openqa.selenium.WebDriverCommandProcessor.getString(WebDriverCommandProcessor.java:111)
    at com.thoughtworks.selenium.DefaultSelenium.getEval(DefaultSelenium.java:479)
    at marklogic2.Common.commonWaitForAjax(Common.java:1172)
    at marklogic.test.MetersOverview.testMetersOverview(MetersOverview.java:111)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.junit.runners.Suite.runChild(Suite.java:127)
    at org.junit.runners.Suite.runChild(Suite.java:26)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:138)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:117)
    at org.junit.runner.JUnitCore.runMain(JUnitCore.java:96)
    at org.junit.runner.JUnitCore.runMainAndExit(JUnitCore.java:47)
    at org.junit.runner.JUnitCore.main(JUnitCore.java:40)
Caused by: org.openqa.selenium.WebDriverException: waiting for evaluate.js load failed
Command duration or timeout: 10.26 seconds
Build info: version: '2.32.0', revision: '6c40c18', time: '2013-04-09 17:22:56'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_25'
Session ID: 5399e6a6-8134-4c08-b6d2-13716b8b96e2
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{platform=XP, databaseEnabled=true, cssSelectorsEnabled=true, javascriptEnabled=true, acceptSslCerts=true, handlesAlerts=true, browserName=firefox, browserConnectionEnabled=true, nativeEvents=true, webStorageEnabled=true, rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true, takesScreenshot=true, version=23.0.1}]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:187)
    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 org.openqa.selenium.internal.seleniumemulation.GetEval.handleSeleneseCommand(GetEval.java:39)
    at org.openqa.selenium.internal.seleniumemulation.GetEval.handleSeleneseCommand(GetEval.java:1)
    at org.openqa.selenium.internal.seleniumemulation.SeleneseCommand.apply(SeleneseCommand.java:35)
    ... 39 more
Caused by: org.openqa.selenium.remote.ErrorHandler$UnknownServerException: waiting for evaluate.js load failed
Build info: version: '2.32.0', revision: '6c40c18', time: '2013-04-09 17:22:56'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_25'
Driver info: driver.version: unknown
    at <anonymous class>.r(file:///C:/Users/sreddy/AppData/Local/Temp/anonymous7980890323570416361webdriver-profile/extensions/fxdriver@googlecode.com/components/driver_component.js:8321)
    at <anonymous class>.fxdriver.Timer.prototype.runWhenTrue/g(file:///C:/Users/sreddy/AppData/Local/Temp/anonymous7980890323570416361webdriver-profile/extensions/fxdriver@googlecode.com/components/driver_component.js:392)
    at <anonymous class>.fxdriver.Timer.prototype.setTimeout/<.notify(file:///C:/Users/sreddy/AppData/Local/Temp/anonymous7980890323570416361webdriver-profile/extensions/fxdriver@googlecode.com/components/driver_component.js:386)

FAILURES!!!
Tests run: 1,  Failures: 1

preguntado el 09 de septiembre de 13 a las 21:09

Although this is Ruby thread,but the same issue i found today. Here it is - ruby-forum.com/topic/4416890#1120944 . but gem update solved the issue. Try the updation. -

I don't want to update because there is locator related bug in v2.35 & many of my tests fail. v2.32 works fine with all my tests except for this firefox issue -

1 Respuestas

You have to do a return in the JS script you're executing, like this:

String status = (String) js.executeScript("return STARTED");

Respondido el 19 de Septiembre de 13 a las 07:09

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.