Skip to content

fix: prefer chromedriverPorts pool over single chromedriverPort when both are set#1076

Open
AsijitM wants to merge 1 commit into
appium:masterfrom
AsijitM:fix-chromedriverports-precedence
Open

fix: prefer chromedriverPorts pool over single chromedriverPort when both are set#1076
AsijitM wants to merge 1 commit into
appium:masterfrom
AsijitM:fix-chromedriverports-precedence

Conversation

@AsijitM

@AsijitM AsijitM commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Problem

setupNewChromedriver resolves the chromedriver port like this:

if (opts.chromedriverPort) {
  // use the single port
} else {
  opts.chromedriverPort = await getChromedriverPort(opts.chromedriverPorts);
}

If a caller provides both the single chromedriverPort and the chromedriverPorts
pool/range, the single port wins and the configured pool is silently ignored. There is then
no way to guarantee that a session picks a free port from the pool — which matters when
several parallel sessions run against the same host and rely on the pool to avoid collisions.

Fix

When both are provided, prefer a free port from the chromedriverPorts pool and log that the
single chromedriverPort is being ignored. Behavior is unchanged when only one of the two is set:

  • only chromedriverPort → use it (as before)
  • only chromedriverPorts → pick from the pool (as before)
  • neither → pick any free port (as before)

Notes

  • Small, self-contained change in setupNewChromedriver; no capability/schema changes.
  • Happy to add a unit test for the precedence if maintainers prefer.

…both are set

When a caller supplies both the deprecated single `chromedriverPort` and the
`chromedriverPorts` pool/range, the single port currently wins and the pool is
silently ignored. That makes it impossible to guarantee a free port is picked
from the configured pool (e.g. when several parallel sessions share a host).

Prefer the `chromedriverPorts` pool when both are provided; behavior is
unchanged when only one of them is set.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mykola-mokhnach

Copy link
Copy Markdown
Contributor
  1. This is a breaking change
  2. It is ok to prefer the concrete value of chromedriverPort if explicitly provided as it narrows down the scope more than chromedriverPorts. Not sure we want to accept this change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants