0

After some time of plucking feathers on this, I have ran out of options.

Im in the process of setting up a selenium based build server and had much success up to the point of introducing Google-Chrome.

I'm at a point now where I can successfully run a test case via selenium and even capture the screenshots no problem on Firefox headless and all but Chrome is not playing ball.

I have followed all the steps I could find from running older versions to re-installations and no luck.

When I call phpunit and the test is set to use Firefox, then all good:

PHPUnit 5.7.20 by Sebastian Bergmann and contributors. Runtime: PHP 7.0.15-0ubuntu0.16.04.4 with Xdebug 2.4.0 Configuration: /private/var/www/functionaltests/vaimodev/tests/functional/phpunit.xml.dist . 1 / 1 (100%) Time: 10.61 seconds, Memory: 4.00MB OK (1 test, 1 assertion)

And now same test but set to use chrome:

1) defaultTest::testTitle PHPUnit_Extensions_Selenium2TestCase_WebDriverException: unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"10699.1","isDefault":true},"id":1,"name":"","origin":"://"} (Session info: chrome=58.0.3029.110) (Driver info: chromedriver=2.9.248304,platform=Linux 4.4.0-72-generic x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 46 milliseconds Build info: version: '3.4.0', revision: 'unknown', time: 'unknown' System info: host: 'm2.vaimo.dev', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-72-generic', java.version: '1.8.0_131' Driver info: org.openqa.selenium.chrome.ChromeDriver Capabilities [{applicationCacheEnabled=false, rotatable=false, chrome={userDataDir=/tmp/.com.google.Chrome.5OdRZX}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, version=58.0.3029.110, platform=LINUX, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}] Session ID: 68262783c1d2f9aba29f813504ed9606

I start up my selenium instance as follows:

DISPLAY=:8.8 java -Dwebdriver.gecko.driver=/home/vagrant/geckodriver -Dwebdriver.chrome.driver=/home/vagrant/chromedriver -Dchrome.binary=/opt/google/chrome/chrome -jar /home/vagrant/selenium-server-standalone-3.4.0.jar -port 4444 > /dev/null 2>&1 &

Any help would be appreciated at this stage...

Kamakazy
  • 111
  • 1
  • 5
  • Do you have the latest version of selenium and chromedriver installed? I have seen reports of a bug in some versions of chromedriver: [Chrome v54 raises SessionNotCreatedError and exits](https://github.com/SeleniumHQ/selenium/issues/2614) – Ali Rad May 26 '17 at 12:17
  • Currently running on latest version of both on clean Vagrant instance although I have tried downgrading all of them both all at the same time and variations of versions for each of them and all give me the same result... – Kamakazy May 26 '17 at 12:26

2 Answers2

0

This is looking strange, it's too small

Command duration or timeout: 46 milliseconds

As option, try to increase timeouts (session & etc)

Also to see code might help :)

  • what code is it you are looking for? I'll share as soon as I know. – Kamakazy May 26 '17 at 13:00
  • I wonder - do you using any DriverCapabilities and at what point test is failing ? Just at the creating browser session ? –  May 26 '17 at 13:05
  • Using it out of the box as stated above... no driver capabilities specified... it seems to be failing at creating the session... even when attempting to do this via the web instance, it just fails to create seesion but FF is perfect.... Im attempting now to tail the logs as the process occurs to see if I can spot anything... – Kamakazy May 26 '17 at 13:12
  • '5:42:03.396 ERROR - org.apache.commons.exec.ExecuteException: Execution failed (Exit value: -559038737. Caused by java.io.IOException: Cannot run program "/home/vagrant/chromedriver" (in directory "."): error=2, No such file or directory)' – Kamakazy May 26 '17 at 13:47
0

Found the problem....

First issue is that chmod +x chromedriver is not enough, I had to add chmod 775 chromedriver to it.

The second issue was a rookie mistake... Note to self!

DOWNLOAD 64bit on 64bit systems!!!!!!!!!! (facepalm)

Kamakazy
  • 111
  • 1
  • 5
  • Never Mind. Although the chrome session is now created, I still receive an error when running the test. `defaultTest::testTitle PHPUnit_Extensions_Selenium2TestCase_WebDriverException: unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"14488.1","isDefault":true},"id":1,"name":"","origin":"://"}` – Kamakazy May 26 '17 at 13:57
  • Problem solved... version 2.9 is older than 2.29. Make sure to download `https://chromedriver.storage.googleapis.com/2.29/chromedriver_linux64.zip` – Kamakazy May 26 '17 at 14:02
  • `wget https://chromedriver.storage.googleapis.com/2.29/chromedriver_linux64.zip` `unzip` – Kamakazy May 26 '17 at 14:03