Using Laravel 5+ with Vagrant.
I have selenium running using:
java -jar vendor/se/selenium-server-standalone/bin/selenium-server-standalone.jar -Dwebdriver.firefox.bin="/usr/bin/firefox"
using a headless display:
sudo Xvfb :10 -ac
However when i run codeception:
./vendor/bin/codecept run selenium --steps
I get the following error:
[FacebookWebDriverExceptionUnknownServerException] Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
Error: GDK_BACKEND does not match available displays
I am confused with server and ports that i should be using.
Currently i access site through http://localhost:8000
however that is outside vagrant.
I observe $url = 'http://localhost:4444/wd/hub'
, inside apivendorfacebookwebdriverlibRemoteRemoteWebDriver.php
As the error outputs :
127.0.0.1 on port 7055.
2
Answers
Switched to chrome web driver, was less complicated, more compatible and works fine for me.
Setup environment
nohup sudo Xvfb :10 -ac &
export DISPLAY=:10
java -jar vendor/se/selenium-server-standalone/bin/selenium-server-standalone.jar -Dwebdriver.chrome.bin="/usr/bin/google-chrome" -Dwebdriver.chrome.driver="vendor/bin/chromedriver"
Actually you should download latest geckodriver from here and set property
Dwebdriver.gecko.driver
with downloaded geckodriver path from your system when you run theselenium-server-standalone.jar
as below :Note : Just like the other drivers available to
Selenium
from other browser vendors,Mozilla
has released an executablegeckodriver
that will run alongside with the latest firefox browser. For more information you should follow this link.Now you need to set capability with
marionette
totrue
during initialisation ofRemoteWebDriver
insideapivendorfacebookwebdriverlibRemoteRemoteWebDriver.php
as :Full example code :