4 Replies Latest reply on Sep 27, 2013 5:05 PM by Rafael Pestano

    Graphene - running tests in remote machine

    Rafael Pestano Novice

      Hi guys,

       

      I need to run my graphene tests in a remote machine, whats the necessary configuration?

       

      Im using this config in arquillian.xml

       

      <extension qualifier="webdriver">

              <property name="browser">${browser}</property>

            

      <!--         <property name="remoteReusable">true</property> -->

              <property name="remoteAddress">http://remoteMachineAddress:4444/wd/hub</property>

      </extension>

       

      but the tests still runs on locally(where the build runs) which doesnt have any browser installed:

       

      Caused by: java.lang.RuntimeException: Unable to instantiate Drone via org.openqa.selenium.firefox.FirefoxDriver(Capabilities): org.openqa.selenium.WebDriverException: Cannot find firefox binary in PATH. Make sure firefox is installed. OS appears to be: LINUX

       

      the remote machine already has a selenium server running and i want my arquillian functional tests to run in that machine cause my integration server doesnt have any browser installed neither graphic support.

       

      Ive tried phantom driver but it behaves differently(some elements are not found/not present) than my local tests that runs in firefox.

      Caused by: org.openqa.selenium.remote.ErrorHandler$UnknownServerException: Error Message => 'Element is not currently visible and may not be manipulated'

       

      Any help is appreaciated.

        • 1. Re: Graphene - running tests in remote machine
          Rafael Pestano Novice

          researching a bit more about headless tests i think phantomjs is the way to go and about my error with it maybe its related with this issue: https://issues.jboss.org/browse/ARQ-1385.

          • 2. Re: Graphene - running tests in remote machine
            Rafael Pestano Novice

            Hi again, i've changed window dimmention in arquillian.xml

             

              <property name="dimensions">1280x1024</property>

             

            and the test work on my machine but still fails with the same error on the integration server, here are GhostDriver capabilities for both enviroments:

             

            local:

            INFO: environment: {}

            PhantomJS is launching GhostDriver...

            [INFO  - 2013-09-27T03:18:02.964Z] GhostDriver - Main - running on port 3526

            [INFO  - 2013-09-27T03:18:03.210Z] Session [6b7e8840-2723-11e3-aac1-874e027829f9] - _decorateNewWindow - page.settings: {"XSSAuditingEnabled":false,"javascriptCanCloseWindows":true,"javascriptCanOpenWindows":true,"javascriptEnabled":true,"loadImages":true,"localToRemoteUrlAccessEnabled":false,"userAgent":"Mozilla/5.0 (Windows NT 6.0) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.2 Safari/534.34","webSecurityEnabled":true}

            [INFO  - 2013-09-27T03:18:03.211Z] Session [6b7e8840-2723-11e3-aac1-874e027829f9] - page.customHeaders:  - {}

            [INFO  - 2013-09-27T03:18:03.211Z] Session [6b7e8840-2723-11e3-aac1-874e027829f9] - CONSTRUCTOR - Desired Capabilities: {"dimensions":"1280x1024","phantomjs.binary.path":"C:\\eclipse\\workspace-red\\apm-arq4-arquillian\\target\\drone-phantomjs"}

            [INFO  - 2013-09-27T03:18:03.211Z] Session [6b7e8840-2723-11e3-aac1-874e027829f9] - CONSTRUCTOR - Negotiated Capabilities: {"browserName":"phantomjs","version":"1.9.2","driverName":"ghostdriver","driverVersion":"1.0.4","platform":"windows-Vista-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":{"proxyType":"direct"}}

            [INFO  - 2013-09-27T03:18:03.211Z] SessionManagerReqHand - _postNewSessionCommand - New Session Created: 6b7e8840-2723-11e3-aac1-874e027829f9

             

            Jenkins:

            INFO: environment: {}
            PhantomJS is launching GhostDriver...
            [INFO  - 2013-09-27T03:20:37.946Z] GhostDriver - Main - running on port 14293
            [INFO  - 2013-09-27T03:20:38.435Z] Session [c80387a0-2723-11e3-a4b9-9b1ac5626ead] - _decorateNewWindow - page.settings: {"XSSAuditingEnabled":false,"javascriptCanCloseWindows":true,"javascriptCanOpenWindows":true,"javascriptEnabled":true,"loadImages":true,"localToRemoteUrlAccessEnabled":false,"userAgent":"Mozilla/5.0 (Unknown; Linux x86_64) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.2 Safari/534.34","webSecurityEnabled":true}
            [INFO  - 2013-09-27T03:20:38.479Z] Session [c80387a0-2723-11e3-a4b9-9b1ac5626ead] - page.customHeaders:  - {}
            [INFO  - 2013-09-27T03:20:38.479Z] Session [c80387a0-2723-11e3-a4b9-9b1ac5626ead] - CONSTRUCTOR - Desired Capabilities: {"dimensions":"1280x1024","phantomjs.binary.path":"/var/procergs/jenkins/workspace/apm-arq4-deploy-desenvolvimento/target/drone-phantomjs"}
            [INFO  - 2013-09-27T03:20:38.479Z] Session [c80387a0-2723-11e3-a4b9-9b1ac5626ead] - CONSTRUCTOR - Negotiated Capabilities: {"browserName":"phantomjs","version":"1.9.2","driverName":"ghostdriver","driverVersion":"1.0.4","platform":"linux-unknown-64bit","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":{"proxyType":"direct"}}
            [INFO  - 2013-09-27T03:20:38.479Z] SessionManagerReqHand - _postNewSessionCommand - New Session Created: c80387a0-2723-11e3-a4b9-9b1ac5626ead

             

            arquillian.xml

             

            <extension qualifier="graphene">

                   <property name="waitGuiInterval">5</property>

                   <property name="waitAjaxInterval">5</property>

                   <property name="waitModelInterval">5</property>

                 

                </extension>

             

                 <extension qualifier="webdriver">

                    <property name="browser">${browser}</property>

                    <property name="dimensions">1280x1024</property>

            <!--         <property name="remoteReusable">true</property> -->

                    <property name="remoteAddress">http://localhost:4444/wd/hub</property>

                </extension>

                <extension qualifier="selenium-server">

                      <property name="port">4444</property>

            <!--         <property name="browserSessionReuse">true</property>  -->

                </extension>

             

            the test which fails is a Primefaces selectOneMenu; and it fails after i click in the component and wait for a specific item to appear, here is the code:

             

            @FindByJQuery("div[id$=curso] .ui-icon-triangle-1-s")

            private GrapheneElement selectOneMenu;

             

            public void select() {

                selectOneMenu.click();//ok

                Graphene.waitAjax().until().element(By.className("ui-selectonemenu-items-wrapper")).is().present(); //ok

                selectOneMenu.findElement(By.className("ui-selectonemenu-item").xpath("//li[text()='apm-arq4']")).click();//error in Jenkins ghostDriver, works on my local machine in any(chrome,firefox and phantomjs) browser

              }

             

            here is the complete stacktrace:

             

            Command duration or timeout: 423 milliseconds
            Build info: version: '2.35.0', revision: '8df0c6bedf70ff9f22c647788f9fe9c8d22210e2', time: '2013-08-17 12:46:41'
            System info: os.name: 'Linux', os.arch: 'amd64', os.version: '2.6.18-238.el5', java.version: '1.7.0_10'
            Session ID: 08982290-2728-11e3-aa80-5d25d64ccce7
            Driver info: org.openqa.selenium.phantomjs.PhantomJSDriver
            Capabilities [{platform=LINUX, acceptSslCerts=false, javascriptEnabled=true, browserName=phantomjs, rotatable=false, driverVersion=1.0.4, locationContextEnabled=false, version=1.9.2, cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=false, browserConnectionEnabled=false, proxy={proxyType=direct}, nativeEvents=true, webStorageEnabled=false, driverName=ghostdriver, applicationCacheEnabled=false, takesScreenshot=true}]
                 at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:125)
                 at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
                 at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:268)
                 at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:79)
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                 at java.lang.reflect.Method.invoke(Method.java:601)
                 at org.jboss.arquillian.graphene.proxy.GrapheneProxyHandler.invokeReal(GrapheneProxyHandler.java:130)
                 at org.jboss.arquillian.graphene.proxy.GrapheneContextualHandler$1.invoke(GrapheneContextualHandler.java:159)
                 at org.jboss.arquillian.graphene.enricher.SearchContextInterceptor.intercept(SearchContextInterceptor.java:50)
                 at org.jboss.arquillian.graphene.proxy.InvocationContextImpl.invoke(InvocationContextImpl.java:87)
                 at org.jboss.arquillian.graphene.intercept.InterceptorBuilder$2.intercept(InterceptorBuilder.java:139)
                 at org.jboss.arquillian.graphene.proxy.InvocationContextImpl.invoke(InvocationContextImpl.java:87)
                 at org.jboss.arquillian.graphene.enricher.StaleElementInterceptor$1.apply(StaleElementInterceptor.java:48)
                 at org.jboss.arquillian.graphene.enricher.StaleElementInterceptor$1.apply(StaleElementInterceptor.java:44)
                 at org.openqa.selenium.support.ui.FluentWait$1.apply(FluentWait.java:177)
                 at org.openqa.selenium.support.ui.FluentWait$1.apply(FluentWait.java:175)
                 at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:208)
                 at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:175)
                 at org.jboss.arquillian.graphene.wait.WebDriverWaitImpl.until(WebDriverWaitImpl.java:87)
                 at org.jboss.arquillian.graphene.enricher.StaleElementInterceptor.intercept(StaleElementInterceptor.java:44)
                 at org.jboss.arquillian.graphene.proxy.InvocationContextImpl.invoke(InvocationContextImpl.java:87)
                 at org.jboss.arquillian.graphene.proxy.GrapheneContextualHandler$2.call(GrapheneContextualHandler.java:209)
                 at org.jboss.arquillian.graphene.context.BrowserActions.performAction(BrowserActions.java:62)
                 at org.jboss.arquillian.graphene.proxy.GrapheneContextualHandler.invoke(GrapheneContextualHandler.java:205)
                 at $Proxy40.click(Unknown Source)
                 at org.jboss.arquillian.graphene.GrapheneElement.click(GrapheneElement.java:111)
                 at com.procergs.test.functional.turma.FormTurmaNovo.selecionaCurso(FormTurmaNovo.java:51)
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                 at java.lang.reflect.Method.invoke(Method.java:601)
                 at org.jboss.arquillian.graphene.proxy.GrapheneProxyHandler.invokeReal(GrapheneProxyHandler.java:130)
                 at org.jboss.arquillian.graphene.proxy.GrapheneContextualHandler$1.invoke(GrapheneContextualHandler.java:159)
                 at org.jboss.arquillian.graphene.proxy.GrapheneContextualHandler$2.call(GrapheneContextualHandler.java:209)
                 at org.jboss.arquillian.graphene.context.BrowserActions.performAction(BrowserActions.java:62)
                 at org.jboss.arquillian.graphene.proxy.GrapheneContextualHandler.invoke(GrapheneContextualHandler.java:205)
                 at org.jboss.arquillian.graphene.proxy.GrapheneContextualHandler.intercept(GrapheneContextualHandler.java:229)
                 at com.procergs.test.functional.turma.FormTurmaNovo$$EnhancerByGraphene$$d1ecd764.selecionaCurso(<generated>)
                 at com.procergs.test.functional.FunctionalTests.deveIncluirTurmaComSucesso(FunctionalTests.java:106)
            Caused by: org.openqa.selenium.remote.ErrorHandler$UnknownServerException: Error Message => 'Element is not currently visible and may not be manipulated'
            caused by Request => {"headers":{"Accept":"application/json, image/png","Connection":"Keep-Alive","Content-Length":"27","Content-Type":"application/json; charset=utf-8","Host":"localhost:9632"},"httpVersion":"1.1","method":"POST","post":"{\"id\":\":wdc:1380253880162\"}","url":"/click","urlParsed":{"anchor":"","query":"","file":"click","directory":"/","path":"/click","relative":"/click","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/click","queryKey":{},"chunks":["click"]},"urlOriginal":"/session/08982290-2728-11e3-aa80-5d25d64ccce7/element/%3Awdc%3A1380253880162/click"}
            Build info: version: '2.35.0', revision: '8df0c6bedf70ff9f22c647788f9fe9c8d22210e2', time: '2013-08-17 12:46:41'
            System info: os.name: 'Linux', os.arch: 'amd64', os.version: '2.6.18-238.el5', java.version: '1.7.0_10'
            Driver info: driver.version: unknown
            • 3. Re: Graphene - running tests in remote machine
              Karel Piwko Master

              Hi Rafael,

               

              few hints:

               

              1/ In order to run remotely, you need to specify <property name="remote">true</property> or <property name="remoteReusable">true</property> properties in arquillian.xml additionaly to remoteAddress.

              2/ You need to run your server on public IP - for remote AS7/WF use bin/standalone.sh -b ${ipaddress}, for managed AS7/WF put <property name="javaVmArguments">-Xmx512m -XX:MaxPermSize=128m -Djboss.bind.address=${ipaddress}</property> into configuration of container in Arquillian

              3/ You should execute grid/hub on machine where browser will be running. You can follow http://code.google.com/p/selenium/wiki/Grid2, just start hub and node

              4/ You should make sure that firewalls let you to communicate. Deployment is still on CI machine!

               

              As for your current setup, it is still running locally, hence the Firefox missing binary. For Phantomjs, it seems that your test is trying to access something not visible, so check your tests that element really exists.

               

              HTH,

               

              Karel

              • 4. Re: Graphene - running tests in remote machine
                Rafael Pestano Novice

                Thanks Karel, it just works.

                 

                Used remote, remoteAddress properties and bindAdress as you suggested.

                 

                <container qualifier="jbossas-managed"  default="true" >

                        <configuration>

                            <property name="jbossHome">${jbossHome}</property>

                            <property name="outputToConsole">true</property>

                            <property name="javaVmArguments">-Xmx512m -Djboss.bind.address=10.124.5.178 -XX:MaxPermSize=512m</property>

                            <property name="allowConnectingToRunningServer">true</property>

                        </configuration>

                    </container>

                 

                <extension qualifier="webdriver">

                        <property name="browser">${browser}</property>

                         <property name="remote">true</property>

                        <property name="remoteAddress">http://glasgow:1000/wd/hub</property>

                   </extension>