Answer the question
In order to leave comments, you need to log in
Does anyone have a working code for php-webdriver?
I have a project on php-webdriver (facebook-webdriver), which used the latest versions of chrome-driver and chrome, since for some reason nothing worked with the last ones. But now there is a problem with the latter - starting with Chrome 80, the --disable-gpu key does not work, and without it, Khromenky starts and immediately crashes with a GPU error. (Correction: it used to work without --disable-gpu. I don't know why it doesn't work now). At the same time, it works fine in headless mode, but I need a window. With Firefox, it didn’t work out at all initially, but there the driver is still in beta, so I put up with it and used Chrome.
Does anyone know of a working fresh code for php-webdriver? It does not matter with which browser and which version.
As for the current errors, they are:
With fresh chrome in the webdriver-manager console:
12:21:50.029 INFO [ActiveSessionFactory.apply] - Capabilities are: {
"browserName": "chrome",
"chromeOptions": {
"binary": "",
"args": [
"--disable-gpu",
" --user-data-dir=\u002ftmp\u002fchrome",
"--no-sandbox",
"--user-agent=Mozilla\u002f5.0 (Windows NT 6.3; Win64; x64) AppleWebKit\u002f537.36 (KHTML , like Gecko) Chrome\u002f81.0.4044.122 Safari\u002f537.36"
]
}
}
12:21:50.029 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.grid.session.remote.ServicedSession $Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
Starting ChromeDriver 83.0.4103.39 (ccbf011cb2d2b19b506d844400483861342c20cd-refs/branch-heads/[email protected]{#416}) on port 28239
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-conside... for suggestions on keeping ChromeDriver safe.
ChromeDriver started successfully.
[1590312110,385][SEVERE]: Unable to receive message from renderer
[12222:12236:0524/122150.245334:WARNING:gpu_process_host.cc(1217)] The GPU process has crashed 1 time(s)
[12222:12253:0524/122150.252709:ERROR:bus.cc(393)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[12222:12253:0524/122150.252761:ERROR:bus.cc(393)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[12222:12253:0524/122150.264437:ERROR:bus.cc(393)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[12222:12253:0524/122150.264501:ERROR:bus.cc(393)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix") [12222:12236:0524/ 122150.297853
:WARNING:gpu_process_host.cc(1217)] The GPU process has crashed 2 time(s)
crashed 3 time(s)
[12222:12236:0524/122150.317477:WARNING:gpu_process_host.cc(1217)
] )] The GPU process has crashed 5 time(s)
[12222:12236:0524/122150.378038:WARNING:gpu_process_host.cc(1217)] The GPU process has crashed 6 time(s)
[12222:12236:0524/122150.378121:FATAL:gpu_data_manager_impl_private.cc(439)] GPU process isn't usable. goodbye.
12:48:55.694 INFO [ActiveSessionFactory.apply] - Capabilities are: {
"browserName": "chrome",
"chromeOptions": {
"binary": "",
"args": [
"--disable-gpu",
" --user-data-dir=\u002ftmp\u002fchrome",
"--no-sandbox"
]
}
}
12:48:55.694 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.grid.session .remote.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
Fatal error: Uncaught Facebook\WebDriver\Exception\SessionNotCreatedException: Unable to create new service: ChromeDriverService
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'lat', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-101-generic', java.version: '14.0.1'
Driver info: driver.version: unknown in /home/me/sc/vendor/php-webdriver/webdriver/lib/Exception/WebDriverException.php:125
Stack trace:
#0 /home/me/sc/ vendor/php-webdriver/webdriver/lib/Remote/HttpCommandExecutor.php(370): Facebook\WebDriver\Exception\WebDriverException::throwException('session not cre...', 'Unable to creat...', Array)
#1 /home/me/sc/vendor/php-webdriver/webdriver/lib/Remote/RemoteWebDriver.php(136): Facebook\WebDriver\Remote\HttpCommandExecutor->execute(Object(Facebook\WebDriver\Remote\WebDriverCommand))
#2 /home/me/sc/test.php(14): Facebook\WebDriver\Remote\RemoteWebDriver::create(' http://localhos... ', Object(Facebook\WebDriver\Remote\DesiredCapabilities))
# 3 in /home/me/sc/vendor/php-webdriver/webdriver/lib/Exception/WebDriverException.php on line 125
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
use Facebook\WebDriver\Chrome\ChromeOptions;
use Facebook\WebDriver\Remote\DesiredCapabilities;
use Facebook\WebDriver\Remote\RemoteWebDriver;
require_once(__DIR__ . '/vendor/autoload.php');
$options = new ChromeOptions();
$options->addArguments(array('--disable-gpu'));
$options->addArguments(array('--user-data-dir=/tmp/chrome'));
$options->addArguments(array("--no-sandbox"));
$caps = DesiredCapabilities::chrome();
$caps->setCapability(ChromeOptions::CAPABILITY, $options); // constant CAPABILITY is deprecated, но что вместо неё - не нашел
$driver = RemoteWebDriver::create('http://localhost:4444/wd/hub/', $caps);
$driver->get('http://ya.ru');
var_dump($driver->getPageSource());
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question