mercredi 25 mai 2016

Selenium & PhantomJS error [Java]

We are implementing functional tests with cucumber and selenium. Our front-end application is based on backbones and marionette. And when we run the tests with Chrome driver everything goes great. But when we change the driver and we use phantomjs, we get the folloging error:

[INFO  - 2016-05-25T07:29:25.974Z] GhostDriver - Main - running on port 25401
[INFO  - 2016-05-25T07:29:26.585Z] Session [68fe2830-224a-11e6-8e2c-478b5c72f5db] - page.settings - {"XSSAuditingEnabled":false,"javascriptCanCloseWindows":true,"javascriptCanOpenWindows":true,"javascriptEnabled":true,"loadImages":true,"localToRemoteUrlAccessEnabled":false,"userAgent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/538.1 (KHTML, like Gecko) PhantomJS/2.1.1 Safari/538.1","webSecurityEnabled":true}
[INFO  - 2016-05-25T07:29:26.585Z] Session [68fe2830-224a-11e6-8e2c-478b5c72f5db] - page.customHeaders:  - {}
[INFO  - 2016-05-25T07:29:26.585Z] Session [68fe2830-224a-11e6-8e2c-478b5c72f5db] - Session.negotiatedCapabilities - {"browserName":"phantomjs","version":"2.1.1","driverName":"ghostdriver","driverVersion":"1.2.0","platform":"windows-7-32bit","javascriptEnabled":true,"takesScreenshot":true,"handlesAlerts":false,"databaseEnabled":false,"locationContextEnabled":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"cssSelectorsEnabled":true,"webStorageEnabled":false,"rotatable":false,"acceptSslCerts":false,"nativeEvents":true,"proxy":{"noProxy":null,"socksUsername":null,"httpProxy":"ALC-1DT2L12:49367","ftpProxy":null,"socksPassword":null,"sslProxy":"ALC-1DT2L12:49367","proxyAutoconfigUrl":null,"proxyType":"MANUAL","class":"org.openqa.selenium.Proxy","autodetect":false,"hCode":1261368293,"socksProxy":null}}
[INFO  - 2016-05-25T07:29:26.585Z] SessionManagerReqHand - _postNewSessionCommand - New Session Created: 68fe2830-224a-11e6-8e2c-478b5c72f5db
[ERROR - 2016-05-25T07:29:48.721Z] WebElementLocator - _handleLocateCommand - Element(s) NOT Found: GAVE UP. Search Stop Time: 1464161388706

phantomjs://platform/console++.js:263 in error
[ERROR - 2016-05-25T07:29:49.511Z] WebElementLocator - _handleLocateCommand - Element(s) NOT Found: GAVE UP. Search Stop Time: 1464161389489

I took a screen capture from phantomjs and the screenshot was a white image. It's like phantomjs try to load the login url but nothing is displayed.

We use the following dependencies:

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>2.48.2</version>
    </dependency>

<dependency>
        <groupId>com.codeborne</groupId>
        <artifactId>phantomjsdriver</artifactId>
        <version>1.2.1</version>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>org.seleniumhq.selenium</groupId>
                <artifactId>selenium-java</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.seleniumhq.selenium</groupId>
                <artifactId>selenium-remote-driver</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

And the code where the test fails:

WebDriverWait espera = new WebDriverWait(getCurrentDriver(), 20);
espera.until(ExpectedConditions.elementToBeClickable(By.cssSelector("#userLogin")));

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire