diff --git a/py/conftest.py b/py/conftest.py index b73f3369c7db2..5ce71b91182c9 100644 --- a/py/conftest.py +++ b/py/conftest.py @@ -159,9 +159,10 @@ def fin(): if driver_instance is None: if driver_class == "Firefox": options = get_options(driver_class, request.config) - # There are issues with window size/position when running Firefox - # under Wayland, so we use XWayland instead. - os.environ["MOZ_ENABLE_WAYLAND"] = "0" + if platform.system() == "Linux": + # There are issues with window size/position when running Firefox + # under Wayland, so we use XWayland instead. + os.environ["MOZ_ENABLE_WAYLAND"] = "0" if driver_class == "Chrome": options = get_options(driver_class, request.config) if driver_class == "Edge": @@ -174,9 +175,6 @@ def fin(): options = get_options("Firefox", request.config) or webdriver.FirefoxOptions() options.set_capability("moz:firefoxOptions", {}) options.enable_downloads = True - # There are issues with window size/position when running Firefox - # under Wayland, so we use XWayland instead. - os.environ["MOZ_ENABLE_WAYLAND"] = "0" if driver_path is not None: kwargs["service"] = get_service(driver_class, driver_path) if options is not None: @@ -315,6 +313,11 @@ def wait_for_server(url, timeout): "is using port {}, continuing...".format(_port) ) except Exception: + remote_env = os.environ.copy() + if platform.system() == "Linux": + # There are issues with window size/position when running Firefox + # under Wayland, so we use XWayland instead. + remote_env["MOZ_ENABLE_WAYLAND"] = "0" print("Starting the Selenium server") process = subprocess.Popen( [ @@ -328,7 +331,8 @@ def wait_for_server(url, timeout): "true", "--enable-managed-downloads", "true", - ] + ], + env=remote_env, ) print(f"Selenium server running as process: {process.pid}") assert wait_for_server(url, 10), f"Timed out waiting for Selenium server at {url}" diff --git a/py/test/selenium/webdriver/common/api_example_tests.py b/py/test/selenium/webdriver/common/api_example_tests.py index 93a2856191009..74e39154a768a 100644 --- a/py/test/selenium/webdriver/common/api_example_tests.py +++ b/py/test/selenium/webdriver/common/api_example_tests.py @@ -239,6 +239,7 @@ def test_is_element_displayed(driver, pages): @pytest.mark.xfail_edge @pytest.mark.xfail_firefox(reason="https://github.com/mozilla/geckodriver/issues/2224") +@pytest.mark.xfail_remote(reason="https://github.com/mozilla/geckodriver/issues/2224") @pytest.mark.xfail_safari def test_move_window_position(driver, pages): pages.load("blank.html") diff --git a/py/test/selenium/webdriver/common/window_tests.py b/py/test/selenium/webdriver/common/window_tests.py index ee79b8e581393..129a95f091ea9 100644 --- a/py/test/selenium/webdriver/common/window_tests.py +++ b/py/test/selenium/webdriver/common/window_tests.py @@ -67,6 +67,7 @@ def test_should_get_the_position_of_the_current_window(driver): @pytest.mark.xfail_chrome @pytest.mark.xfail_edge @pytest.mark.xfail_firefox(reason="https://github.com/mozilla/geckodriver/issues/2224") +@pytest.mark.xfail_remote(reason="https://github.com/mozilla/geckodriver/issues/2224") def test_should_set_the_position_of_the_current_window(driver): position = driver.get_window_position() @@ -94,6 +95,7 @@ def test_should_get_the_rect_of_the_current_window(driver): @pytest.mark.xfail_edge @pytest.mark.xfail_firefox(reason="https://github.com/mozilla/geckodriver/issues/2224") +@pytest.mark.xfail_remote(reason="https://github.com/mozilla/geckodriver/issues/2224") @pytest.mark.xfail_safari(raises=WebDriverException, reason="Get Window Rect command not implemented") def test_should_set_the_rect_of_the_current_window(driver): rect = driver.get_window_rect()