geckodriver icon indicating copy to clipboard operation
geckodriver copied to clipboard

Set window size through Selenium Grid occasionally doesn't work

Open arnonax-tr opened this issue 2 years ago • 7 comments

System

  • Version: 0.31.0
  • Platform: Linux
  • Firefox: 101.0
  • Selenium: Selenium.WebDriver 4.2.0 (.Net) + Selenium Grid 4.1.4 (revision 535d840ee2)

Testcase

        [Test]
        [Repeat(100)]
        public void BrowserResolutionFirefox()
        {
            var fxProfile = new FirefoxProfile();
            var driverOptions = new FirefoxOptions { Profile = fxProfile };
            driverOptions.LogLevel = FirefoxDriverLogLevel.Trace;
            using var driver = new RemoteWebDriver(new Uri(GridUrl), driverOptions.ToCapabilities(), TimeSpan.FromMinutes(10));

            driver.Manage().Window.Size = new Size(500, 600);

            var outerWidth = driver.ExecuteJavaScript<long>("return window.outerWidth");
            var outerHeight = driver.ExecuteJavaScript<long>("return window.outerHeight");
            Assert.AreEqual(500, outerWidth, "Width");
            Assert.AreEqual(600, outerHeight, "Height");
        }

Notes:

  • This doesn't happen consistently, but with the [Repeat(100)] it always fails.
  • Once it doesn't work, retrying the same operation again (of setting the window size) doesn't work either, at least for a whole minute.

Stacktrace

  Width
  Expected: 500
  But was:  1224

Trace-level log

Attached. FirefoxSizeLog.txt

arnonax-tr avatar Jun 09 '22 14:06 arnonax-tr

Thanks for the report. We indeed had issues in the past and interestingly in the Firefox Nightly build from yesterday we landed an improvement. Do you have a chance to test your script with such a Firefox build? You can get it from https://www.mozilla.org/en-US/firefox/channel/desktop/#nightly.

I would appreciate your feedback.

whimboo avatar Jun 10 '22 06:06 whimboo

Thanks! I'd be happy to try that build. However, because I can reproduce it only on Selenium Grid, I need an image of Selenium Firefox Node . Can you provide me such an image, or advise how I can create one?

arnonax-tr avatar Jun 12 '22 07:06 arnonax-tr

Sorry, but I'm not familiar with this project. If you aren't able to build we may have to wait with the verification until the patches are in a release build of Firefox. Let me get back to you when it is the case.

whimboo avatar Jun 14 '22 13:06 whimboo

Thanks. In the meantime I'll see if I can somehow work around the docker image and reproduce it without it. I just want you to clarify something: the improvement that you think might resolve the issue is in the Firefox browser's code, not in GeckoDriver?

arnonax-tr avatar Jun 15 '22 05:06 arnonax-tr

Yes, it's a recent fix in Firefox and not geckodriver.

whimboo avatar Jun 15 '22 08:06 whimboo

@arnonax-tr can we now close this issue?

whimboo avatar Sep 21 '22 09:09 whimboo

Thanks! I’ll try to check it this week.

Arnon Axelrod

Chief Automation and CI/CD Architect, eToro

Buy my book: Complete Guide to Test Automation https://www.amazon.com/Complete-Guide-Test-Automation-Maintaining/dp/1484238311

Read my blog: @.***

From: Henrik Skupin @.> Sent: Friday, June 10, 2022 9:21 AM To: mozilla/geckodriver @.> Cc: arnonax-tr @.>; Author @.> Subject: Re: [mozilla/geckodriver] Set window size through Selenium Grid occasionally doesn't work (Issue #2025)

Thanks for the report. We indeed had issues in the past and interestingly in the Firefox Nightly build from yesterday we landed an improvement. Do you have a chance to test your script with such a Firefox build? You can get it from https://www.mozilla.org/en-US/firefox/channel/desktop/#nightly.

I would appreciate your feedback.

— Reply to this email directly, view it on GitHub https://github.com/mozilla/geckodriver/issues/2025#issuecomment-1151998986, or unsubscribe https://github.com/notifications/unsubscribe-auth/APAQFAU4DLMCDK4PXNPASHDVOLNGLANCNFSM5YKIFCVA . You are receiving this because you authored the thread.Message ID: < @.***>

arnonax-tr avatar Oct 11 '22 08:10 arnonax-tr