Skip to content

[πŸ› Bug]: Chrome Driver 137.0.7151.5500 resolution scaling issuesΒ #15851

@ciconq

Description

@ciconq

Description

Hello,

I am running tests both locally and on an agent(Azure DevOps) that is on a virtual server - Microsoft Windows Server 2022 Standard. The tests are ran under the --headless=new flag. Some tests have bigger grids which are not always displayed on the entire screen but they were working fine under Chrome Driver 135.0.7049.4200.
I had to add the following flags for them to pass again:

--force-device-scale-factor=0.75
--high-dpi-support=0.75

This was working fine both locally and on the server until I had to upgrade to Chrome Driver 137.0.7151.5500.

Now I am noticing some really strange resolution scaling when running tests with different permutations of flags/settings.

1st permutation: Removing both flags from Chrome Driver settings
Resulted in having same resolution both on the server and locally - 800x600 when running tests in headless.
Running them in non-headless resulted in having a resolution -1032x776 on the server and - 1552x928 locally.

2nd permutation: Removing both flags from Chrome Driver settings but having flag --window-size=1920,1080
Resulted in having same resolution both on the server and locally - 800x600 when running tests in headless.
Running them in non-headless resulted in having a resolution - 1032x776 on the server and - 1552x928 locally(same as 1st permutation).

3rd permutation: Removing both flags from Chrome Driver settings but having resolution set via the driver
Resulted in having same resolution both on the server and locally - 800x600 when running tests in headless.
Running them in non-headless resulted in having a resolution -1032x776 on the server and - 1552x928 locally(same as 1st and 2nd permutations).

4th permutation: Having both flags --force-device-scale-factor and --high-dpi-support set to 0.75 without any additional resolution flags/settings
Resulted in having same resolution both on the server and locally - 1423x1067 when running tests in headless.
Running them in non-headless resulted in having a resolution -1377x1036 on the server and - 2584x1544 locally.

5th permutation: Having only --force-device-scale-factor flag set to 0.75 without any additional resolution flags/settings Resulted in having same resolution both on the server and locally - 1423x1067 when running tests in headless.
Running them in non-headless resulted in having a resolution -1377x1036 on the server and - 2584x1544 locally(same as 4th permutation).

6th permutation: Having only --force-device-scale-factor flag set to 0.7 without any additional resolution flags/settings Resulted in having same resolution both on the server and locally - 1633x1226 when running tests in headless.
Running them in non-headless resulted in having a resolution -1475x1109 on the server and - 2769x1655 locally(this worked both locally and on the server for headless, for non-headless it worked only locally, I guess it failed on the server due to the nearly double less in size resolution).

What I can see is that the resolution is the same when running tests in --headless=new both on the server and locally for all of the mentioned permutations. On the other hand I guess having different resolution when running tests in non-headless both on the server and locally might be normal.

Additionally I suspect that the resolution was different when running tests in headless both on the server and locally for Chrome Driver 135.0.7049.4200 but I am not sure but at least it was not defaulting to such low resolution like 800x600(not sure if adding the --disable-mobile-emulation flag might help but I don't see why it would).

P.S. Tried pretty much all of those permutations with Selenium 4.33.0 but still the same outcome(also if it matters I am using a 16 inch laptop with a resolution of 1920x1200 if that matters, not sure about the server though).

Would really appreciate any ideas or suggestions.

Thank you for your time and attention reading this!

Reproducible Code

Those are the flags that I am initializing a Chrome Driver of based on the mentioned permutations:

var options = new ChromeOptions();

options.AddArgument("--window-size=1920,1080");
options.AddArguments("--force-device-scale-factor=0.75");
options.AddArguments("high-dpi-support=0.75");

return new ChromeDriver(chromeDriverService, options);

Setting the driver window size from the driver itself:

Driver.Manage().Window.Size = new Size(1920, 1080);

ℹ️ Last known working version: 4.27.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    G-chromedriverRequires fixes in ChromeDriver

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions