Skip to content

Commit b71db45

Browse files
committed
[py] Remove CDP support for Firefox
1 parent 95c31fb commit b71db45

File tree

2 files changed

+6
-20
lines changed

2 files changed

+6
-20
lines changed

py/selenium/webdriver/remote/webdriver.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,10 +1201,8 @@ def start_devtools(self):
12011201

12021202
devtools = cdp.import_devtools(version)
12031203
if self.caps["browserName"].lower() == "firefox":
1204-
warnings.warn(
1205-
"CDP support for Firefox is deprecated and will be removed in future versions. Please switch to WebDriver BiDi.",
1206-
DeprecationWarning,
1207-
stacklevel=2,
1204+
raise RuntimeError(
1205+
"CDP support for Firefox has been removed. Please switch to WebDriver BiDi."
12081206
)
12091207
self._websocket_connection = WebSocketConnection(ws_url)
12101208
targets = self._websocket_connection.execute(devtools.target.get_targets())
@@ -1262,9 +1260,7 @@ def _get_cdp_details(self):
12621260
debugger_address = self.caps.get("goog:chromeOptions").get("debuggerAddress")
12631261
elif self.caps.get("browserName") == "MicrosoftEdge":
12641262
debugger_address = self.caps.get("ms:edgeOptions").get("debuggerAddress")
1265-
else:
1266-
_firefox = True
1267-
debugger_address = self.caps.get("moz:debuggerAddress")
1263+
12681264
res = http.request("GET", f"http://{debugger_address}/json/version")
12691265
data = json.loads(res.data)
12701266

@@ -1273,12 +1269,7 @@ def _get_cdp_details(self):
12731269

12741270
import re
12751271

1276-
if _firefox:
1277-
# Mozilla Automation Team asked to only support 85
1278-
# until WebDriver Bidi is available.
1279-
version = 85
1280-
else:
1281-
version = re.search(r".*/(\d+)\.", browser_version).group(1)
1272+
version = re.search(r".*/(\d+)\.", browser_version).group(1)
12821273

12831274
return version, websocket_url
12841275

py/test/selenium/webdriver/common/devtools_tests.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,13 @@
2020

2121

2222
@pytest.mark.xfail_safari
23+
@pytest.mark.xfail_firefox
2324
def test_check_console_messages(driver, pages):
2425
with pytest.warns(None) as record:
2526
devtools, connection = driver.start_devtools()
2627
console_api_calls = []
2728

28-
if driver.caps["browserName"].lower() == "firefox":
29-
assert (
30-
record[0].message.args[0]
31-
== "CDP support for Firefox is deprecated and will be removed in future versions. Please switch to WebDriver BiDi."
32-
)
33-
else:
34-
assert len(record) == 0
29+
assert len(record) == 0
3530

3631
connection.execute(devtools.runtime.enable())
3732
connection.on(devtools.runtime.ConsoleAPICalled, console_api_calls.append)

0 commit comments

Comments
 (0)