Skip to content

With 4.18.1-20240224 I get a DevToolsActivePort file doesn't exist #1094

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

Closed
elnath78 opened this issue Mar 10, 2024 · 15 comments
Closed

With 4.18.1-20240224 I get a DevToolsActivePort file doesn't exist #1094

elnath78 opened this issue Mar 10, 2024 · 15 comments
Labels
bug Something isn't working

Comments

@elnath78
Copy link

elnath78 commented Mar 10, 2024

Bug description

Fatal error: Uncaught Facebook\WebDriver\Exception\SessionNotCreatedException: Could not start a new session. Could not start a new session. Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: session not created: DevToolsActivePort file doesn't exist Host info: host: 'd1a93cda54a8', ip: '172.18.0.5' Build info: version: '4.18.1', revision: 'b1d3319b48' System info: os.name: 'Linux', os.arch: 'amd64', os.version: '6.5.0-25-generic', java.version: '11.0.21' Driver info: driver.version: unknown Build info: version: '4.18.1', revision: 'b1d3319b48' System info: os.name: 'Linux', os.arch: 'amd64', os.version: '6.5.0-25-generic', java.version: '11.0.21' Driver info: driver.version: unknown Build info: version: '4.18.1', revision: 'b1d3319b48' System info: os.name: 'Linux', os.arch: 'amd64', os.version: '6.5.0-25-generic', java.version: '11.0.21' Driver info: driver.version: unknown in C:\xampp\htdocs\redacted\vendor\php-webdriver\webdriver\lib\Exception\WebDriverException.php on line 130

How could the issue be reproduced

//Set Up Chrome Options
$chromeOptions = new ChromeOptions();
$chromeOptions->setExperimentalOption('w3c', false);
$chromeOptions->addArguments($args);
//Set Capabilities
$seleniumCapabilities = DesiredCapabilities::chrome();
$seleniumCapabilities->setCapability('acceptSslCerts', false);
//Create Selenium Connection
$driver = RemoteWebDriver::create($seleniumHost, $seleniumCapabilities);
//Go To URL
$url="https://en.wikipedia.org/wiki/Selenium_(software)";
$driver->navigate()->to($url);
//Exit, do nothing just pray connection works
$driver->quit();

Expected behavior

I'd be happy if I can set a connection, would be a great upgrade.

Php-webdriver version

1.15.1

PHP version

8.2.0

How do you start the browser driver or Selenium server

selenium in docker

Selenium server / Selenium Docker image version

4.18.1-20240224

Browser driver (chromedriver/geckodriver...) version

where should I run this?

Browser name and version

where should I run this?

Operating system

Ubuntu

Additional context

# To execute this docker-compose yml file use `docker-compose -f docker-compose-v3.yml up`
# Add the `-d` flag at the end for detached execution
# To stop the execution, hit Ctrl+C, and then `docker-compose -f docker-compose-v3.yml down`
version: "3"
services:
  chrome:
    image: selenium/node-chrome:4.18.1-20240224
    shm_size: 2gb
    depends_on:
      - selenium-hub
    environment:
      - SE_EVENT_BUS_HOST=selenium-hub
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443

  edge:
    image: selenium/node-edge:4.18.1-20240224
    shm_size: 2gb
    depends_on:
      - selenium-hub
    environment:
      - SE_EVENT_BUS_HOST=selenium-hub
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443

  firefox:
    image: selenium/node-firefox:4.18.1-20240224
    shm_size: 2gb
    depends_on:
      - selenium-hub
    environment:
      - SE_EVENT_BUS_HOST=selenium-hub
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443

  selenium-hub:
    image: selenium/hub:4.18.1-20240224
    container_name: selenium-hub
    ports:
      - "4442:4442"
      - "4443:4443"
      - "4444:4444"
@elnath78 elnath78 added the bug Something isn't working label Mar 10, 2024
@elnath78
Copy link
Author

elnath78 commented Mar 10, 2024

I did a try with https://github.com/php-webdriver/php-webdriver/blob/main/example.php this time I got a Fatal error: Maximum execution time of 120 seconds exceeded in C:\xampp\htdocs\redacted\vendor\php-webdriver\webdriver\lib\Remote\HttpCommandExecutor.php on line 325 with the stack trace pointing at \RemoteWebDriver.php:129

I forgot to mention I have a cd /opt/selenium/ && docker-compose up -d set in my crontab with a @reboot directive to start selenium when I need to reboot, not sure if detached mode could complicate things up.

@elnath78
Copy link
Author

edit Adding user: directive in the .yml file didnt help, I have read this would have fixed the bug, but not in my case.

@OndraM
Copy link
Collaborator

OndraM commented Mar 11, 2024

Hi,

  1. Do not disable w3c mode (ie. remove $chromeOptions->setExperimentalOption('w3c', false);) . What is the reason for this? The old mode is deprecated an may not work properly.
  2. If it won't help, try disabling sandbox mode in Chrome:
$chromeOptions = new ChromeOptions();
$chromeOptions->addArguments(['--no-sandbox']);
$chromeOptions->addArguments($args);
// ...

And please report if it fixed the issue. Also, this is probably not a bug in php-webdriver, but behavior of Chromedriver...

And there is already multiple discussion threads for this: #898, #964, #1091...

Also a stackoverflow question: https://stackoverflow.com/questions/50642308/webdriverexception-unknown-error-devtoolsactiveport-file-doesnt-exist-while-t

(I also see you created docker-selenium issue, so linking it for reference: SeleniumHQ/docker-selenium#2164)

@OndraM OndraM added the waiting for reaction Further information/reaction is requested label Mar 11, 2024
@elnath78
Copy link
Author

@OndraM Hi, I have updated in a comment I'm now using https://github.com/php-webdriver/php-webdriver/blob/main/example.php to test it with a working sample, and I'm getting a Fatal error: Maximum execution time of 120 seconds exceeded in C:\xampp\htdocs\redacted\vendor\php-webdriver\webdriver\lib\Remote\HttpCommandExecutor.php on line 325

@github-actions github-actions bot removed the waiting for reaction Further information/reaction is requested label Mar 11, 2024
@OndraM
Copy link
Collaborator

OndraM commented Mar 11, 2024

Please, try to reproduce the issue in the minimal setup possible.

Could you please:

  • Provide the command(s) you use to start docker
  • Provide the command you use to start the PHP script
  • Provide exactly the full PHP script you run

There seems to be some issue with your setup.

@OndraM OndraM added the waiting for reaction Further information/reaction is requested label Mar 11, 2024
@elnath78
Copy link
Author

elnath78 commented Mar 11, 2024

Provide the command(s) you use to start docker

docker-compose up inside the folder with .yml file

  • Provide the command you use to start the PHP script

I open the web browser and navigate to the script page.

Provide exactly the full PHP script you run

https://github.com/php-webdriver/php-webdriver/blob/main/example.php

@github-actions github-actions bot removed the waiting for reaction Further information/reaction is requested label Mar 11, 2024
@OndraM
Copy link
Collaborator

OndraM commented Mar 11, 2024

  • Provide the command you use to start the PHP script

I open the web browser and navigate to the script page.

What does it mean exactly, could you elaborate please? How you run the "example.php" script?

@elnath78
Copy link
Author

What does it mean exactly, could you elaborate please? How you run the "example.php" script?

What is not clear in I open my browser and navigate? I type in the address in the browser.

@OndraM
Copy link
Collaborator

OndraM commented Mar 11, 2024

Well, this is not a way to run such PHP script. You should be running it from command line using php, not through web-server - this could be the cause of the issue.

If the selenium is stared on you machine (and you can open http://localhost:4444 to see selenium dashboard), then you can run the script from the command line like this:

php example.php

@elnath78
Copy link
Author

You should be running it from command line

I got it now, I tried that way early, also I uploaded the php on a VPS and tried both way, connecting to it via browser and in SSH but the result didn't differ. The only working option was using selenium/standalone-chrome:4.18.1-20240224 with all node-* it keep failing. im struggling now with standalone, I don't think it has all the controls that will let me pick tags and nevigate the DOM, I'll need to keep testing.

@OndraM
Copy link
Collaborator

OndraM commented Mar 12, 2024

Ok, good to hear.

But from all this I don't see there an bug in php-webdriver, so closing this issue.

@OndraM OndraM closed this as completed Mar 12, 2024
@elnath78
Copy link
Author

@OndraM The bug persist, it has not been resolved, just hidden under the rug. If you replicate my setup described above you will be able to replicate also the bug.

@OndraM
Copy link
Collaborator

OndraM commented Mar 12, 2024

@elnath78 Yup, this is what I did yesterday, and everything worked as expected. The docker-compose.yml is exactly the one you provided, the example.php is exactly the one from this repo.

$ docker-compose up -d
[+] Running 4/4
 ✔ Container selenium-hub         Started                                                                                                                                                                                                                                                                                                      0.0s 
 ✔ Container test-1094-chrome-1   Started                                                                                                                                                                                                                                                                                                      0.0s 
 ✔ Container test-1094-firefox-1  Started                                                                                                                                                                                                                                                                                                      0.0s 
 ✔ Container test-1094-edge-1     Started                                                                                                                                                                                                                                                                                                      0.0s 

$ php example.php 
The title is 'PHP - Wikipedia'
The current URL is 'https://en.wikipedia.org/wiki/PHP'
About to click to button with text: 'View history'
The title is 'PHP: Revision history - Wikipedia'
The current URI is 'https://en.wikipedia.org/w/index.php?title=PHP&action=history'
Array
(
    [0] => Facebook\WebDriver\Cookie Object
        (
            [cookie:protected] => Array
                (
                    [name] => cookie_set_by_selenium
                    [value] => cookie_value
                    [path] => /
                    [domain] => en.wikipedia.org
                    [secure] => 1
                    [httpOnly] => 
                    [sameSite] => Lax
                )

        )

)

@elnath78
Copy link
Author

@OndraM did you use this from an external device? In my setup I was on XAMPP (php) and the docker-selenium was on a Ubuntu VPS with firewall port 4444 open for TCP inbound.

@OndraM
Copy link
Collaborator

OndraM commented Mar 15, 2024

@elnath78 No, I tried it locally.

You are describing quite unusual setup, which is another lead to believe this is issue with your setup, not this library. And I am unable to help you with that, sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants