7 Replies Latest reply on Jul 21, 2014 8:05 AM by kpiwko

    How to configure chrome binary correctly in arquillian.xml?

    tilm4nn

      Hi Community,

       

      at the moment I am trying to run my arquillian tests with chrome (ff and phantomjs are working). But I always get

      org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary

       

      I am using

      drone 1.2.3.Final

      selenium 2.39.0

      chromedriver 2.9

      chrome 32.0.1700.102

      on windows 7

       

      The configuration in arquillian.xml looks like:

          <extension qualifier="webdriver">

              <property name="browser">chrome</property>

              <property name="chrome.binary">D:\testtools\GoogleChromePortable\App\Chrome-bin\chrome.exe</property>

              <property name="chromeDriverBinary">D:\testtools\chromedriver\chromedriver.exe</property>

          </extension>

       

      The referenced binary is chrome portable. I have no installed version of chrome on the machine.

       

      In addition to the exception given above I get the following warnings:

       

      Warning: The system property "chrome.binary" used in Arquillian "webdriver" configuration is deprecated, please rather use new format "chromeBinary"

      Feb 10, 2014 6:47:23 PM org.jboss.arquillian.drone.configuration.ConfigurationMapper injectField

      Warning: The property "chromeBinary" used in Arquillian "webdriver" configuration is deprecated.

      Feb 10, 2014 6:47:23 PM org.jboss.arquillian.drone.configuration.legacy.LegacyConfigurationMapper$DefaultCapabilityMapping remapKey

      Warning: Configuration property "chromeBinary" is deprecated, please replace it with capability based property "chrome.binary" instead.

       

      I also tried to change the configuration property to chromeBinary but I get the same exception and almost the same warnings either way.

       

      Is there something I have missed?

       

      Cheers, Tilmann

        • 1. Re: How to configure chrome binary correctly in arquillian.xml?
          kpiwko

          Hi Tilmann,

           

          If I understand this document correctly - https://sites.google.com/a/chromium.org/chromedriver/capabilities, you should set up a property named "binary" in arquillian.xml in order to use custom path to Chrome browser binary.

           

          Let me know if that helps.

           

          Karel

          • 2. Re: How to configure chrome binary correctly in arquillian.xml?
            tilm4nn

            Hi Karel,

             

            thanks for your input and the link provided. The information presented there and the fact that I still get the same exception lead me to a little debugging. Maybe the problem is that the chromedriver cannot find the binary configuration propterty because it expects it inside a ChromeOptions object inside the DesiredCapabilities object. But what we are doing here is just setting a String value inside the DesiredCapabilities object.

             

            So maybe it is not possible at all to configure the chrome binary using arquillian.xml at the moment?

             

            Cheers, Tilmann

            • 3. Re: How to configure chrome binary correctly in arquillian.xml?
              kpiwko

              You have discovered a bug, thanks! It might work with previous version of Chrome - although they haven't mentioned this change in changelog - http://selenium.googlecode.com/git/java/CHANGELOG

               

              Hence I filled a bug in Drone - [ARQ-1638] Chrome driver options are not wrapped into ChromeOptions object - JBoss Issue Tracker . I'll make it a part of 1.2.4.Final release.

               

              Thank you once again,

               

              Karel

              • 4. Re: How to configure chrome binary correctly in arquillian.xml?
                kpiwko

                Hey Tilmann,

                 

                I went through the code and discovered that chrome.binary should be the way to go. ChromeOptions object is not needed so far, because it is actually converted to Capabilities object by ChromeDriver itself.

                However, there was a bug in handling deprecation. I fixed that - or I'm going to fix that based on you feedback in ARQ-1638 ;-).

                 

                So, could you please try new Drone 1.2.4.Final to see whether that fixes your issue? Is it released in JBoss Maven Staging repository - that's how you enable it:

                 

                Maven Staging Settings

                 

                Many thanks,

                 

                Karel

                • 5. Re: How to configure chrome binary correctly in arquillian.xml?
                  kpiwko

                  Did you have chance to try the fix?

                   

                  Thanks,

                   

                  Karel

                  • 6. Re: How to configure chrome binary correctly in arquillian.xml?
                    tilm4nn

                    Hi Karel,

                     

                    Thanks for looking into this. Sadly I was occupied with other projects till now. Today I had the chance to check it out. While your fix resolves the warning about the deprecated capability it does not solve the problem with the binary configuration itself. What is handed to the WebDriver now (that does not work) is:

                    {
                         "desiredCapabilities":{
                              "platform":"ANY",
                              "browserName":"chrome",
                              "chrome.binary":"D:\\testtools\\GoogleChromePortable\\App\\Chrome-bin\\chrome.exe",
                              "version":""
                         }
                    }
                    

                     

                    As mentioned before is seems that chrome webdriver (I am using v2.9) ignores the capability "chrome.binary" and expects a chromeOptions object instead. The following has been verified to work for me:

                            System.setProperty("webdriver.chrome.driver", "D:\\testtools\\chromedriver\\chromedriver.exe");
                            ChromeOptions options = new ChromeOptions();
                            options.setBinary("D:\\testtools\\GoogleChromePortable\\App\\Chrome-bin\\chrome.exe");
                            WebDriver driver = new ChromeDriver(options);
                            driver.get("http://www.jboss.org");
                            driver.quit();
                    

                    Wich in turn leads to the following send to the webdriver:

                    {
                         "desiredCapabilities":{
                              "platform":"ANY",
                              "browserName":"chrome",
                              "chromeOptions":{
                                   "binary":"D:\\testtools\\GoogleChromePortable\\App\\Chrome-bin\\chrome.exe",
                                   "args":[],
                                   "extensions":[]
                              },
                              "version":""
                         }
                    }
                    

                     

                    In arquillian.xml I tried to add a property called chromeOptions with value

                    {"binary":"D:\testtools\GoogleChromePortable\App\Chrome-bin\chrome.exe","args":[],"extensions":[]}

                    But of course this won't work. The ChromeDriver is doing string escaping to JSON correctly here

                    Is there another way I can put it into arquillian.xml so that the above is generated or is there still a fix in drone required?

                     

                    Cheers, Tilmann

                    • 7. Re: How to configure chrome binary correctly in arquillian.xml?
                      kpiwko

                      Thanks for investigation. In such case we need to fix Drone - to transparently pass value of chromeBinary from capability to ChromeOptions.

                       

                      See https://issues.jboss.org/browse/ARQ-1823

                       

                      Karel