Skip to content

Commit 657f5d3

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

File tree

3 files changed

+25
-6
lines changed

3 files changed

+25
-6
lines changed

.github/workflows/ci-python.yml

+18
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,21 @@ jobs:
116116
run: |
117117
bazel test --local_test_jobs 1 --flaky_test_attempts 3 //py:common-${{ matrix.browser }}-bidi
118118
bazel test --local_test_jobs 1 --flaky_test_attempts 3 //py:test-${{ matrix.browser }}
119+
120+
safari-tests:
121+
name: Browser Tests
122+
needs: build
123+
uses: ./.github/workflows/bazel.yml
124+
strategy:
125+
fail-fast: false
126+
matrix:
127+
include:
128+
- browser: safari
129+
os: macos
130+
with:
131+
name: Integration Tests (${{ matrix.browser }}, ${{ matrix.os }})
132+
browser: ${{ matrix.browser }}
133+
os: ${{ matrix.os }}
134+
cache-key: py-browser-${{ matrix.browser }}
135+
run: |
136+
bazel test --local_test_jobs 1 --flaky_test_attempts 3 //py:test-${{ matrix.browser }}

py/selenium/webdriver/remote/webdriver.py

+6-5
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

+1-1
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)