Skip to content
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

Window Repositioning Broken #2042

Closed
titusfortner opened this issue Sep 1, 2022 · 16 comments
Closed

Window Repositioning Broken #2042

titusfortner opened this issue Sep 1, 2022 · 16 comments
Labels

Comments

@titusfortner
Copy link

Selenium project tests started failing with Firefox v104. I only see it happening on Github, and can't reproduce it locally, even on my Linux VM.

With this code:

avail_width = driver.execute_script('return window.screen.availWidth')
avail_height = driver.execute_script('return window.screen.availHeight')

orig_rect = window.rect
new_rect = Rectangle.new(50, 50, avail_width - 150, avail_height - 150)
window.rect = new_rect

begin
  wait.until { window.rect == new_rect }
rescue Selenium::WebDriver::Error::TimeoutError
  raise "original: #{orig_rect}; new: #{new_rect}; current: #{window.rect}"
end

This is the exception:

original: #<struct Selenium::WebDriver::Rectangle x=0, y=0, width=1152, height=921>; 
new: #<struct Selenium::WebDriver::Rectangle x=50, y=50, width=1130, height=874>; 
current: #<struct Selenium::WebDriver::Rectangle x=0, y=0, width=1130, height=874>

So, the height and width were properly changed, but the x and y values were not.

https://github.com/SeleniumHQ/selenium/runs/8139181072?check_suite_focus=true#step:10:1375

@whimboo
Copy link
Collaborator

whimboo commented Sep 5, 2022

@titusfortner we didn't change anything around Set Window Rect for Marionette in Firefox 104. So this is interesting. Does it only reproduce in CI or do you see the same locally? I would be interested in a trace log, and maybe a more granular regression range with beta releases if you can reproduce.

@whimboo
Copy link
Collaborator

whimboo commented Sep 5, 2022

Oh I missed that you cannot reproduce locally. Maybe you can tweak a CI run to produce some log files. That would be great.

@titusfortner
Copy link
Author

Let me see what I can do there. And it was definitely FF 104, always passed before, always failed after.

titusfortner added a commit to SeleniumHQ/selenium that referenced this issue Sep 7, 2022
titusfortner added a commit to SeleniumHQ/selenium that referenced this issue Sep 7, 2022
titusfortner added a commit to SeleniumHQ/selenium that referenced this issue Sep 7, 2022
titusfortner added a commit to SeleniumHQ/selenium that referenced this issue Sep 7, 2022
titusfortner added a commit to SeleniumHQ/selenium that referenced this issue Sep 7, 2022
@titusfortner
Copy link
Author

@whimboo
Copy link
Collaborator

whimboo commented Sep 8, 2022

Oh, I'm sorry! When I checked the list of fixed bugs I only checked these for the Marionette component but not any other. So especially for this release we had a fix as part of Firefox in https://bugzilla.mozilla.org/show_bug.cgi?id=1780212 which definitely would have caused that for you. The question now is what's wrong with restoring the window from maximized state as what it looks like to be the case here.

@whimboo
Copy link
Collaborator

whimboo commented Sep 8, 2022

I filed as https://bugzilla.mozilla.org/show_bug.cgi?id=1789823. @titusfortner do you actually have a job that doesn't run under xvfb? If yes, does it fail there as well?

@titusfortner
Copy link
Author

I can't duplicate the problem in my Linux VM. Even when I set window.maximize first.

@whimboo
Copy link
Collaborator

whimboo commented Sep 8, 2022

Do you run the tests with xvfb? I wonder if that's related.

@whimboo
Copy link
Collaborator

whimboo commented Sep 8, 2022

Also do you have a chance to run the job in CI with the MOZ_LOG=Widget:5 environment variable set? It should print details which hopefully will help to diagnose the underlying problem.

@whimboo
Copy link
Collaborator

whimboo commented Sep 12, 2022

@titusfortner any further feedback? We would kinda appreciate a log for widget.

@whimboo
Copy link
Collaborator

whimboo commented Sep 13, 2022

Thanks a lot @titusfortner! Do you know if Firefox starts in fullscreen mode or if the xvfb config for GitHub doesn't have a window manager installed? Maybe that's the reason why Firefox cannot correctly determine and set a specific window state.

[Parent 2499: Main Thread]: D/Widget [7faac303a000]: GetScreenBounds 0,0 -> 1152 x 921, unscaled 0,0 -> 1152 x 921
[Parent 2499: Main Thread]: D/Widget [7faac303a000]: nsWindow::Move to 10 10
[Parent 2499: Main Thread]: D/Widget [7faac303a000]:   size state is not normal, bailing

@whimboo
Copy link
Collaborator

whimboo commented Sep 13, 2022

Actually when inspecting the Widget logs a bit further I can see that Firefox gets started automatically in maximized mode. So please drop that part. I'll let an engineer examine the log and hopefully we have some ideas soon. Thanks again!

@whimboo
Copy link
Collaborator

whimboo commented Sep 13, 2022

@titusfortner what is the difference to the Python jobs? They seem to work fine in CI for some of the most recent commits: https://github.com/SeleniumHQ/selenium/actions/runs/3040228998/jobs/4896101362

For these jobs there is also xvfb with DISPLAY: 99 in use. So I wonder what makes the Ruby job special.

@whimboo
Copy link
Collaborator

whimboo commented Sep 20, 2022

As discovered this is only a problem when tests are run with Xvfb and no window manager installed. That's basically a not supported configuration and needs to be fixed in Selenium CI. The following pull request is open from myself that will take care of it:

SeleniumHQ/selenium#11025

Given that this is not a geckodriver issue I'm closing this issue.

@whimboo
Copy link
Collaborator

whimboo commented Sep 26, 2022

FYI this issue got fixed via SeleniumHQ/selenium#11025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants