Skip to content

Commit

Permalink
[java][js] Add Firefox CDP deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
pujagani authored and jkim2492 committed Nov 17, 2024
1 parent 6422da7 commit 2ddbe1f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions java/src/org/openqa/selenium/devtools/CdpEndpointFinder.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ public static Optional<URI> getReportedUri(Capabilities caps) {
break;
case "firefox":
key = "moz:debuggerAddress";
LOG.warning(
"CDP support for Firefox is deprecated and will be removed in future versions. "
+ "Please switch to WebDriver BiDi.");
break;
default:
return Optional.empty();
Expand Down
7 changes: 7 additions & 0 deletions java/src/org/openqa/selenium/firefox/FirefoxDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,13 @@ private FirefoxDriver(

Optional<URI> reportedUri =
CdpEndpointFinder.getReportedUri("moz:debuggerAddress", capabilities);

if (reportedUri.isPresent()) {
LOG.warning(
"CDP support for Firefox is deprecated and will be removed in future versions. "
+ "Please switch to WebDriver BiDi.");
}

Optional<HttpClient> client =
reportedUri.map(uri -> CdpEndpointFinder.getHttpClient(factory, uri));
Optional<URI> cdpUri;
Expand Down
6 changes: 6 additions & 0 deletions javascript/node/selenium-webdriver/lib/webdriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -1230,6 +1230,12 @@ class WebDriver {

const caps = await this.getCapabilities()

if (caps['map_'].get('browserName') === 'firefox') {
console.warn(
'CDP support for Firefox is deprecated and will be removed in future versions. Please switch to WebDriver BiDi.',
)
}

if (process.env.SELENIUM_REMOTE_URL) {
const host = new URL(process.env.SELENIUM_REMOTE_URL).host
const sessionId = await this.getSession().then((session) => session.getId())
Expand Down

0 comments on commit 2ddbe1f

Please sign in to comment.