Skip to content

Instantly share code, notes, and snippets.

@rrcfesc
Last active April 24, 2020 21:15
Show Gist options
  • Save rrcfesc/a39e5f076213727b2b24b4bfecdf9700 to your computer and use it in GitHub Desktop.
Save rrcfesc/a39e5f076213727b2b24b4bfecdf9700 to your computer and use it in GitHub Desktop.
1) MedTrainer\Tests\Selenium\Integrations\AscaBundle\CreateAscaCourseTest::testWebinarLink
Facebook\WebDriver\Exception\UnknownServerException: unknown error: Chrome failed to start: exited abnormally.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
(Driver info: chromedriver=81.0.4044.69 (6813546031a4bc83f717a2ef7cd4ac6ec1199132-refs/branch-heads/4044@{#776}),platform=Linux 5.0.0-1036-azure x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 106 milliseconds
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: '728e2befb3f3', ip: '192.168.240.3', os.name: 'Linux', os.arch: 'amd64', os.version: '5.0.0-1036-azure', java.version: '1.8.0_242'
Driver info: driver.version: unknown
withDockerSeleniumNetwork2{ n ->
docker.image('mysql:5.7').withRun("--network ${n} --name=${n}medtrainer-db -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=medtrainer_test") { c ->
docker.image('selenium/standalone-chrome:3.141.59').withRun("--network ${n} --name=${n}medtrainer-hub -e START_XVFB=false --shm-size=2g") {
docker.image('apachephp:5.6').inside("--network ${n} --name=${n}medtrainer-web --expose=4444 -e SYMFONY_ENVIRONMENT='dev' -e SYMFONY_ENV='dev' -e SYMFONY_DEBUG=0 -v $JENKINS_HOME/composer-cache:/.cache/composer -v $JENKINS_HOME/npm-cache:/.cache/npm -v $JENKINS_HOME/phpcs-cache:/.cache/phpcs -v $JENKINS_HOME/slack-members-cache:$workspace/symfony/app/config/slack") { container->
parallel_selenium_pre_build(sh(script: "pwd", returnStdout: true).trim())
globalFunctional(n)
parallel_selenium_assetic_and_setup_env()
globalTestEnv("test","selenium --debug")
}
}
}
}
<?php
namespace Company\Selenium;
use Facebook\WebDriver\Chrome\ChromeOptions;
use Facebook\WebDriver\Remote\DesiredCapabilities;
use Facebook\WebDriver\Remote\RemoteWebDriver;
use Facebook\WebDriver\WebDriverDimension;
use InvalidArgumentException;
final class WebDriverFactory
{
/**
* @param bool $mode
* @param string|null $url
*
* @return RemoteWebDriver
*/
public static function get($mode = false, $url = null)
{
$optionsChrome = ['--whitelisted-ips', '--no-sandbox'];
if ($mode === false) {
$optionsChrome[] = '--headless';
$optionsChrome[] = '--disable-gpu';
}
$options = new ChromeOptions();
$options->addArguments($optionsChrome);
$capabilities = DesiredCapabilities::chrome();
$capabilities->setCapability(ChromeOptions::CAPABILITY, $options);
$webDriver = RemoteWebDriver::create(
$url,
$capabilities,
480000,
480000
);
$window = $webDriver->manage()->window();
$window->setSize(new WebDriverDimension(1366, 768));
return $webDriver;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment