Skip to content

Commit ef0d787

Browse files
committed
[py] Fix remote firefox test
Signed-off-by: Viet Nguyen Duc <[email protected]>
1 parent 22e277b commit ef0d787

File tree

3 files changed

+25
-8
lines changed

3 files changed

+25
-8
lines changed

.github/workflows/ci-python.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,6 @@ jobs:
100100
fail-fast: false
101101
matrix:
102102
include:
103-
- browser: safari
104-
os: macos
105103
- browser: chrome
106104
os: ubuntu
107105
- browser: edge
@@ -116,3 +114,21 @@ jobs:
116114
run: |
117115
bazel test --local_test_jobs 1 --flaky_test_attempts 3 //py:common-${{ matrix.browser }}-bidi
118116
bazel test --local_test_jobs 1 --flaky_test_attempts 3 //py:test-${{ matrix.browser }}
117+
118+
safari-tests:
119+
name: Browser Tests
120+
needs: build
121+
uses: ./.github/workflows/bazel.yml
122+
strategy:
123+
fail-fast: false
124+
matrix:
125+
include:
126+
- browser: safari
127+
os: macos
128+
with:
129+
name: Integration Tests (${{ matrix.browser }}, ${{ matrix.os }})
130+
browser: ${{ matrix.browser }}
131+
os: ${{ matrix.os }}
132+
cache-key: py-browser-${{ matrix.browser }}
133+
run: |
134+
bazel test --local_test_jobs 1 --flaky_test_attempts 3 //py:test-${{ matrix.browser }}

py/selenium/webdriver/remote/webdriver.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,12 @@ def start_devtools(self):
10571057
raise WebDriverException("Unable to find url to connect to from capabilities")
10581058

10591059
devtools = cdp.import_devtools(version)
1060+
if self.caps["browserName"].lower() == "firefox":
1061+
warnings.warn(
1062+
"CDP support for Firefox is deprecated and will be removed in future versions. Please switch to WebDriver BiDi.",
1063+
DeprecationWarning,
1064+
stacklevel=2,
1065+
)
10601066
self._websocket_connection = WebSocketConnection(ws_url)
10611067
targets = self._websocket_connection.execute(devtools.target.get_targets())
10621068
target_id = targets[0].target_id
@@ -1127,11 +1133,6 @@ def _get_cdp_details(self):
11271133
if _firefox:
11281134
# Mozilla Automation Team asked to only support 85
11291135
# until WebDriver Bidi is available.
1130-
warnings.warn(
1131-
"CDP support for Firefox is deprecated and will be removed in future versions. Please switch to WebDriver BiDi.",
1132-
DeprecationWarning,
1133-
stacklevel=2,
1134-
)
11351136
version = 85
11361137
else:
11371138
version = re.search(r".*/(\d+)\.", browser_version).group(1)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def test_check_console_messages(driver, pages):
2525
devtools, connection = driver.start_devtools()
2626
console_api_calls = []
2727

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

0 commit comments

Comments
 (0)