Skip to content

Commit ba61851

Browse files
committed
[py] Use Chrome instead of Firefox for internal Remote tests
1 parent 8ddb020 commit ba61851

File tree

4 files changed

+19
-17
lines changed

4 files changed

+19
-17
lines changed

.github/workflows/ci-python.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ jobs:
8181
fail-fast: false
8282
matrix:
8383
include:
84-
- browser: firefox
84+
- browser: chrome
8585
with:
8686
name: Integration Tests (remote, ${{ matrix.browser }})
8787
browser: ${{ matrix.browser }}

py/conftest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class SupportedOptions(ContainerProtocol):
131131
edge: str = "EdgeOptions"
132132
safari: str = "SafariOptions"
133133
ie: str = "IeOptions"
134-
remote: str = "FirefoxOptions"
134+
remote: str = "ChromeOptions"
135135
webkitgtk: str = "WebKitGTKOptions"
136136
wpewebkit: str = "WPEWebKitOptions"
137137

@@ -249,8 +249,8 @@ def options(self, cls_name):
249249
# under Wayland, so we use XWayland instead.
250250
os.environ["MOZ_ENABLE_WAYLAND"] = "0"
251251
elif self.driver_class == self.supported_drivers.remote:
252-
self._options = getattr(webdriver, self.supported_options.firefox)()
253-
self._options.set_capability("moz:firefoxOptions", {})
252+
self._options = getattr(webdriver, self.supported_options.chrome)()
253+
self._options.set_capability("goog:chromeOptions", {})
254254
self._options.enable_downloads = True
255255
else:
256256
opts_cls = getattr(self.supported_options, cls_name.lower())

py/test/selenium/webdriver/remote/remote_connection_tests.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,18 @@
2727
from selenium.webdriver.remote.client_config import ClientConfig
2828

2929

30-
def test_browser_specific_method(driver, pages):
30+
def test_browser_specific_method(firefox_options, webserver):
3131
"""This only works on Firefox"""
32-
pages.load("simpleTest.html")
33-
screenshot = driver.execute("FULL_PAGE_SCREENSHOT")["value"]
34-
result = base64.b64decode(screenshot)
35-
kind = filetype.guess(result)
36-
assert kind is not None and kind.mime == "image/png"
32+
server_addr = f"http://{webserver.host}:{webserver.port}"
33+
with webdriver.Remote(options=firefox_options) as driver:
34+
driver.get(f"{server_addr}/simpleTest.html")
35+
screenshot = driver.execute("FULL_PAGE_SCREENSHOT")["value"]
36+
result = base64.b64decode(screenshot)
37+
kind = filetype.guess(result)
38+
assert kind is not None and kind.mime == "image/png"
3739

3840

39-
def test_remote_webdriver_with_http_timeout(firefox_options, webserver):
41+
def test_remote_webdriver_with_http_timeout(chromium_options, webserver):
4042
"""This test starts a remote webdriver with an http client timeout
4143
set less than the implicit wait timeout, and verifies the http timeout
4244
is triggered first when waiting for an element.
@@ -46,14 +48,14 @@ def test_remote_webdriver_with_http_timeout(firefox_options, webserver):
4648
server_addr = f"http://{webserver.host}:{webserver.port}"
4749
client_config = ClientConfig(remote_server_addr=server_addr, timeout=http_timeout)
4850
assert client_config.timeout == http_timeout
49-
with webdriver.Remote(options=firefox_options, client_config=client_config) as driver:
51+
with webdriver.Remote(options=chromium_options, client_config=client_config) as driver:
5052
driver.get(f"{server_addr}/simpleTest.html")
5153
driver.implicitly_wait(wait_timeout)
5254
with pytest.raises(ReadTimeoutError):
5355
driver.find_element(By.ID, "no_element_to_be_found")
5456

5557

56-
def test_remote_webdriver_with_websocket_timeout(firefox_options, webserver):
58+
def test_remote_webdriver_with_websocket_timeout(chromium_options, webserver):
5759
"""This test starts a remote webdriver that uses websockets, and has a websocket
5860
client timeout less than the default. It verifies the websocket times out according
5961
to this value.
@@ -66,8 +68,8 @@ def test_remote_webdriver_with_websocket_timeout(firefox_options, webserver):
6668
remote_server_addr=server_addr, websocket_timeout=websocket_timeout, websocket_interval=websocket_interval
6769
)
6870
assert client_config.websocket_timeout == websocket_timeout
69-
firefox_options.enable_bidi = True
70-
with webdriver.Remote(options=firefox_options, client_config=client_config) as driver:
71+
chromium_options.enable_bidi = True
72+
with webdriver.Remote(options=chromium_options, client_config=client_config) as driver:
7173
driver._start_bidi()
7274
assert driver._websocket_connection.response_wait_timeout == websocket_timeout
7375
assert driver._websocket_connection.response_wait_interval == websocket_interval

py/test/selenium/webdriver/remote/remote_custom_locator_tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ def convert(self, by, value):
3030

3131

3232
@pytest.fixture()
33-
def custom_locator_driver(firefox_options):
34-
driver = webdriver.Remote(options=firefox_options, locator_converter=CustomLocatorConverter())
33+
def custom_locator_driver(chromium_options):
34+
driver = webdriver.Remote(options=chromium_options, locator_converter=CustomLocatorConverter())
3535
yield driver
3636
driver.quit()
3737

0 commit comments

Comments
 (0)