Skip to content

Set custom webdriver port with ENV var and checking port availability#1124

Open
usernameComputer01 wants to merge 3 commits intophp-webdriver:mainfrom
usernameComputer01:main
Open

Set custom webdriver port with ENV var and checking port availability#1124
usernameComputer01 wants to merge 3 commits intophp-webdriver:mainfrom
usernameComputer01:main

Conversation

@usernameComputer01
Copy link

Chrome: WEBDRIVER_CHROME_CUSTOM_PORT
Firefox: WEBDRIVER_FIREFOX_CUSTOM_PORT

    Chrome: WEBDRIVER_CHROME_CUSTOM_PORT
    Firefox: WEBDRIVER_FIREFOX_CUSTOM_PORT
@williamdes
Copy link
Collaborator

Does such env exist in another project ?
could we use more standard ones ?

@usernameComputer01
Copy link
Author

Does such env exist in another project ? could we use more standard ones ?

I didn't find any information on the ENV standard for webdriver.

@usernameComputer01 usernameComputer01 force-pushed the main branch 2 times, most recently from b893e92 to 153a1ad Compare March 28, 2025 12:22
@usernameComputer01 usernameComputer01 changed the title Set custom webdriver port with ENV var Set custom webdriver port with ENV var and checking port availability Mar 28, 2025
@usernameComputer01
Copy link
Author

usernameComputer01 commented Mar 28, 2025

Added checking for availability of listening port

Co-authored-by: William Desportes <williamdes@wdes.fr>
Copy link
Collaborator

@williamdes williamdes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks okay, @OndraM ?

Copy link
Collaborator

@OndraM OndraM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Could you please update the sockets dependency? 🙏

/**
* @throws RuntimeException
*/
protected static function checkPortIsAvail(int $port)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
protected static function checkPortIsAvail(int $port)
protected static function checkPortIsAvailable(int $port)

No need for shortcuts :)

*/
protected static function checkPortIsAvail(int $port)
{
$errTest = static function ($sock) use ($port) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method should check if the Sockets extension is enabled, and if not, it should just return true (ie. the same behavior as before - without free port detection).

@OndraM OndraM added the waiting for reaction Further information/reaction is requested label Jan 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting for reaction Further information/reaction is requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants