Google Chrome 79.0.3945.130
ChromeDriver 79.0.3945.36
selenium-server-4.0.0-alpha-4.jar
Newest code from the php-webdriver GitHub as of 1/22/2020
I am starting the Selenium server in standalone mode on localhost using Xfvb as such:
$ Xvfb :99 -screen 5 1920x1080x8 &
$ export DISPLAY=:99
$ java -Dwebdriver.chrome.driver="./chromedriver" -jar selenium-server-4.0.0-alpha-4.jar standalone
I then have a test helper class which starts things up in the PHP code:
1 final public static function createWebDriver() {
2 $options = new ChromeOptions();
3 $options->addArguments(array('--window-size=1920,1080'));
4 $caps= DesiredCapabilities::chrome();
5 $caps->setCapability(ChromeOptions::CAPABILITY, $options);
6 $driver = RemoteWebDriver::create('http://localhost:4444/wd/hub', $caps);
7 $driver->manage()->window()->maximize();
8 return $driver;
9}
When I run a test and call the RemoteWebDriver::create() function, it throws an exception:
Facebook\WebDriver\Exception\UnknownCommandException: Unable to find handler for (POST) /wd/hub/session /home/me/UnitTest/vendor/facebook/webdriver/lib/Exception/WebDriverException.php:137 /home/me/UnitTest/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php:380 /home/me/UnitTest/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php:136 /var/www/html/project/core/functions/SeleniumTestHelper.php:6
The line that's the issue is:
$driver = RemoteWebDriver::create('http://localhost:4444/wd/hub', $caps);
I confirm with netstat that I am listening on all addresses to port 4444. I cannot find a directory called "hub" on my machine. I'm not sure why this isn't working and it would seem there is not any more info than this exception for me to go off of.