-
Notifications
You must be signed in to change notification settings - Fork 852
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP-Webdriver does not spin a new geckodriver/firefox process and does not create a log file #1048
Comments
Hi, Nevertheless, we have a test covering exactly this scenario (starting Geckodriver in headless mode) and it works fine. Also if I try exactly the script you provide, it also works without an issue on my machine, so I cannot reproduce this. It seems there may be something specific related to your setup. If you try spinning up geckodriver -p=9515 and you can see the output right in the terminal. You can add To connect to this instance, use it as remote server on localhost:9515. $capabilities = DesiredCapabilities::firefox();
$firefoxOptions = new FirefoxOptions();
$firefoxOptions->addArguments(['-headless']);
$capabilities->setCapability(FirefoxOptions::CAPABILITY, $firefoxOptions);
$serverUrl = 'http://localhost:9515';
$driver = RemoteWebDriver::create($serverUrl, $capabilities);
$driver->get('https://example.com');
echo $driver->getTitle();
$driver->quit(); Let us know what is the result or if you find anything in the error log. |
Hi, as I mentioned in the additional context section, starting geckodriver manually and using |
Oh, sorry, I missed that. Then its even more weird, because php-webdriver should not be doing anything different than starting the geckodriver on port 9515. If you are doing it manually, are you using the same port 9515? There could be something occupying this port, for example. |
In the past when I started geckodriver manually I did not specify a port. This is the output in the terminal of your example:
|
Thanks, so this is the output when running the process manually, right? Because there is no error, according to the log it createw new session, responds, and then visit a new URL. |
@ltanase77 Ok, so to make it easier to debug, I implemented a prototype feature which enables storing output of the geckodriver process to a file.
$desiredCapabilities = DesiredCapabilities::firefox();
$firefoxOptions = new FirefoxOptions();
$firefoxOptions->addArguments(['-headless']);
$firefoxOptions->setOption('log', ['level' => 'trace']);
$desiredCapabilities->setCapability(FirefoxOptions::CAPABILITY, $firefoxOptions);
$service = FirefoxDriverService::createDefaultService('/tmp/geckodriver.log'); // or use different file name
$driver = FirefoxDriver::startUsingDriverService($service, $desiredCapabilities);
$driver->get('https://example.com');
echo $driver->getTitle();
$driver->quit(); And check how it behaves, if the error is still present, provide the full output of the geckodriver.log. |
Yes, the output is when I start manually the geckodriver and I got echoed in the browser the title of github.com website. So, in my composer.json instead of |
This is the output of the geckodriver.log:
|
There is no MarionetteActivePort file in that profile directory (just an user.js file), so of course it fails to open it.
|
This may be issue of geckodriver, lets wait if mozilla/geckodriver#2082 gives any hints. |
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. |
Bug description
PHP-WebDriver does not succeed in making geckodriver to connect to marionette port, when using
FirefoxDriver::start($desiredCapabilities);
in headless mode. Furthermore, although an option is passed for setting the log level no geckodriver.log file is created and thus there is very little info available for determining what is going on.How could the issue be reproduced
Expected behavior
As per documentation, the script should start geckodriver directly, which in turn spin of firefox and get the content of the targeted web page.
Php-webdriver version
1.13
PHP version
7.4.15
How do you start the browser driver or Selenium server
N/A
Selenium server / Selenium Docker image version
No response
Browser driver (chromedriver/geckodriver...) version
0.32
Browser name and version
Firefox 109.0.1 (headless)
Operating system
Debian 10
Additional context
Starting manually geckodriver and using
RemoteWebDriver::create($serverUrl, $desiredCapabilities);
make the script work, but this implies running geckodriver on a permament basis. I want to use the script as Laravel Job which to run once per day, and therefore it is unnecessary to have geckodriver running permanently.This is the exception returned by PHP-Webdriver when the log level is set:
When I am not setting the log level it returns the following error message:
Facebook\WebDriver\Exception\TimeoutException Failed to read marionette port
The text was updated successfully, but these errors were encountered: