Skip to content

[🐛 Bug]: [py] Unable to set window position in Firefox #15584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
cgoldberg opened this issue Apr 7, 2025 · 3 comments · Fixed by #15601
Open

[🐛 Bug]: [py] Unable to set window position in Firefox #15584

cgoldberg opened this issue Apr 7, 2025 · 3 comments · Fixed by #15601
Labels
A-needs-triaging A Selenium member will evaluate this soon! C-py Python Bindings D-firefox I-defect Something is not working as intended OS-linux

Comments

@cgoldberg
Copy link
Contributor

cgoldberg commented Apr 7, 2025

Description

When you call driver.set_window_position(x, y) using Firefox, the window position is not set. I am pretty sure this is a geckodriver issue, and I already reported it:

mozilla/geckodriver#2224

I am just reporting it here to track the issue on the Selenium side and will close this once fixed.

The following test is failing in Selenium's Python/Firefox CI job because of this:

FAILED py/test/selenium/webdriver/common/api_example_tests.py::test_move_window_position[firefox] - assert 0 == 50

Reproducible Code

from selenium import webdriver

driver = webdriver.Firefox()
driver.set_window_position(50, 50)

Debugging Logs

Selenium Manager binary found at: /home/cgoldberg617/code/selenium/py/selenium/webdriver/common/linux/selenium-manager
Executing process: /home/cgoldberg617/code/selenium/py/selenium/webdriver/common/linux/selenium-manager --browser firefox --debug --language-binding python --output json
geckodriver not found in PATH
firefox not found in PATH
firefox not found in the system
Required browser: firefox 137.0
firefox 137.0 already exists
firefox 137.0 is available at /home/cgoldberg617/.cache/selenium/firefox/linux64/137.0/firefox
Required driver: geckodriver 0.36.0
geckodriver 0.36.0 already in the cache
Driver path: /home/cgoldberg617/.cache/selenium/geckodriver/linux64/0.36.0/geckodriver
Browser path: /home/cgoldberg617/.cache/selenium/firefox/linux64/137.0/firefox
Started executable: `/home/cgoldberg617/.cache/selenium/geckodriver/linux64/0.36.0/geckodriver` in a child process with pid: 26445 using 0 to output -3
POST http://localhost:53805/session {'capabilities': {'firstMatch': [{}], 'alwaysMatch': {'browserName': 'firefox', 'acceptInsecureCerts': True, 'moz:debuggerAddress': True, 'pageLoadStrategy': <PageLoadStrategy.normal: 'normal'>, 'browserVersion': None, 'moz:firefoxOptions': {'binary': '/home/cgoldberg617/.cache/selenium/firefox/linux64/137.0/firefox', 'prefs': {'remote.active-protocols': 3}}}}}
Remote response: status=200 | data={"value":{"sessionId":"1d307608-760e-4f31-970a-d8bc7290d74f","capabilities":{"acceptInsecureCerts":true,"browserName":"firefox","browserVersion":"137.0","moz:accessibilityChecks":false,"moz:buildID":"20250327043313","moz:debuggerAddress":"127.0.0.1:49303","moz:geckodriverVersion":"0.36.0","moz:headless":false,"moz:platformVersion":"6.6.67-06628-g571b599e617d","moz:processID":26448,"moz:profile":"/tmp/rust_mozprofile39S6FX","moz:shutdownTimeout":60000,"moz:webdriverClick":true,"moz:windowless":false,"pageLoadStrategy":"normal","platformName":"linux","proxy":{},"setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:137.0) Gecko/20100101 Firefox/137.0"}}} | headers=HTTPHeaderDict({'content-type': 'application/json; charset=utf-8', 'cache-control': 'no-cache', 'content-length': '814', 'date': 'Mon, 07 Apr 2025 03:46:45 GMT'})
Finished Request
POST http://localhost:53805/session/1d307608-760e-4f31-970a-d8bc7290d74f/window/rect {'x': 50, 'y': 50, 'width': None, 'height': None}
Remote response: status=200 | data={"value":{"x":0,"y":0,"width":488,"height":240}} | headers=HTTPHeaderDict({'content-type': 'application/json; charset=utf-8', 'cache-control': 'no-cache', 'content-length': '48', 'date': 'Mon, 07 Apr 2025 03:46:49 GMT'})
Finished Request
@cgoldberg cgoldberg added A-needs-triaging A Selenium member will evaluate this soon! I-defect Something is not working as intended labels Apr 7, 2025
@selenium-ci
Copy link
Member

@cgoldberg, thank you for creating this issue. We will troubleshoot it as soon as we can.

Selenium Triage Team: remember to follow the Triage Guide

@cgoldberg
Copy link
Contributor Author

This is happening because it is not possible to programatically set the window position when running under the Wayland display server (Linux).

There is now an issue open for Firefox to display a better error message in this circumstance:

https://bugzilla.mozilla.org/show_bug.cgi?id=1959040

@cgoldberg cgoldberg closed this as not planned Won't fix, can't repro, duplicate, stale Apr 8, 2025
@cgoldberg
Copy link
Contributor Author

I am re-opening this because setting window position is still broken in Firefox on Linux, whether you are running Wayland or not:

mozilla/geckodriver#2224

The following test files in the internal test suite have failures because of this:

py/test/selenium/webdriver/common/window_tests.py
py/test/selenium/webdriver/common/api_example_tests.py

(you can see failures in recent CI runs)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-needs-triaging A Selenium member will evaluate this soon! C-py Python Bindings D-firefox I-defect Something is not working as intended OS-linux
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants