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 43c569b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/ci-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,21 @@ jobs:
include:
- browser: safari
os: macos
test-common: ""
- browser: chrome
os: ubuntu
test-common: "-bidi"
- browser: edge
os: ubuntu
test-common: "-bidi"
- browser: firefox
os: ubuntu
test-common: "-bidi"
with:
name: Integration Tests (${{ matrix.browser }}, ${{ matrix.os }})
browser: ${{ matrix.browser }}
os: ${{ matrix.os }}
cache-key: py-browser-${{ matrix.browser }}
run: |
bazel test --local_test_jobs 1 --flaky_test_attempts 3 //py:common-${{ matrix.browser }}-bidi
bazel test --local_test_jobs 1 --flaky_test_attempts 3 //py:common-${{ matrix.browser }}${{ matrix.test-common }}
bazel test --local_test_jobs 1 --flaky_test_attempts 3 //py:test-${{ matrix.browser }}
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.",

Check warning on line 1052 in py/selenium/webdriver/remote/webdriver.py

View check run for this annotation

Codecov / codecov/patch

py/selenium/webdriver/remote/webdriver.py#L1050-L1052

Added lines #L1050 - L1052 were not covered by tests
DeprecationWarning,
stacklevel=2,

Check warning on line 1054 in py/selenium/webdriver/remote/webdriver.py

View check run for this annotation

Codecov / codecov/patch

py/selenium/webdriver/remote/webdriver.py#L1054

Added line #L1054 was not covered by tests
)

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 43c569b

Please sign in to comment.