Skip to content

Commit

Permalink
[py] Fix remote firefox test
Browse files Browse the repository at this point in the history
Signed-off-by: Viet Nguyen Duc <[email protected]>
  • Loading branch information
VietND96 committed Nov 21, 2024
1 parent 22e277b commit 1b2bb39
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions py/selenium/webdriver/remote/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,13 @@ def start_devtools(self):
import_cdp()

if not devtools:
if self.caps["browserName"].lower() == "firefox":
warnings.warn(
"CDP support for Firefox is deprecated and will be removed in future versions. Please switch to WebDriver BiDi.",
DeprecationWarning,
stacklevel=2,
)

if self.caps.get("se:cdp"):
ws_url = self.caps.get("se:cdp")
version = self.caps.get("se:cdpVersion").split(".")[0]
Expand Down Expand Up @@ -1127,11 +1134,6 @@ def _get_cdp_details(self):
if _firefox:
# Mozilla Automation Team asked to only support 85
# until WebDriver Bidi is available.
warnings.warn(
"CDP support for Firefox is deprecated and will be removed in future versions. Please switch to WebDriver BiDi.",
DeprecationWarning,
stacklevel=2,
)
version = 85
else:
version = re.search(r".*/(\d+)\.", browser_version).group(1)
Expand Down
2 changes: 1 addition & 1 deletion py/test/selenium/webdriver/common/devtools_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_check_console_messages(driver, pages):
devtools, connection = driver.start_devtools()
console_api_calls = []

if driver.capabilities["browserName"] == "firefox":
if driver.caps["browserName"].lower() == "firefox":
assert (
record[0].message.args[0]
== "CDP support for Firefox is deprecated and will be removed in future versions. Please switch to WebDriver BiDi."
Expand Down

0 comments on commit 1b2bb39

Please sign in to comment.