I am doing running all tests using PHPUnit. Created a wrapper that launches an instance of Apache, then starts the Selenium standalone server, then creates the Chrome Remote Webdriver instance at
http://localhost:4444/wd/hub. This process works 100% of the time on our dev machines, and 90% of the time on the test server, but from time to time, the tests fail as such:
[exec] 1) Intranet\Pages\FinancialReportsSeleniumTest::test_changeMonthYear
[exec] Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http POST to /session with params: {"desiredCapabilities":{"browserName":"chrome","platform":"ANY","chromeOptions":{"binary":"","args":["--window-size=1400,900","--no-sandbox","--headless"]},"goog:chromeOptions":{"args":["--window-size=1400,900","--no-sandbox","--headless"]}}}
[exec]
[exec] Failed to connect to localhost port 4444: Connection refused
[exec]
[exec] C:\Jenkins\jobs\Intranet-Master\workspace\vendor\facebook\webdriver\lib\Remote\HttpCommandExecutor.php:292
[exec] C:\Jenkins\jobs\Intranet-Master\workspace\vendor\facebook\webdriver\lib\Remote\RemoteWebDriver.php:126
[exec] C:\Jenkins\jobs\Intranet-Master\workspace\phpunit\library\Intranet\Selenium.php:364
[exec] C:\Jenkins\jobs\Intranet-Master\workspace\phpunit\library\Intranet\Selenium.php:51
[exec] C:\Jenkins\jobs\Intranet-Master\workspace\phpunit\library\Intranet\SeleniumTestCase.php:9
If we re-run the tests, works fine the next time.
Dev Machines:
Windows 10 Pro (1809) (64 bit)
Apache 2.4.38 (32 bit)
PHP 7.2.15 (32 bit)
Java 1.8.0_192 (64 bit)
Selenium 3.14.0
Selenium Chrome Driver 73.0.3683.20
Test Machine
Windows Server 2008 R2 x64 (64 bit)
Apache 2.4.38 (32 bit)
PHP 7.2.15 (32 bit)
Jenkins 2.1.64
Java 1.8.0_192 (64 bit)
Selenium 3.14.0
Selenium Chrome Driver 73.0.3683.20
I just realized that we are not on the most current version of Selenium, so I will update that, but nothing in the release notes indicates it's addressing the type of issue we are having.
Log file shows that the server is up:
10:41:27.392 INFO [GridLauncherV3.launch] - Selenium build info: version: '3.14.0', revision: 'aacccce0'
10:41:27.392 INFO [GridLauncherV3$1.launch] - Launching a standalone Selenium Server on port 4444
10:41:28.562 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444