microsoft / EasyRepro

Automated UI testing API for Dynamics 365
MIT License
513 stars 285 forks source link

[HOW-TO] Headless mode always fails Chrome #1343

Open JakeObrienMercuryXrm opened 1 year ago

JakeObrienMercuryXrm commented 1 year ago

When running the solution in Chrome headless mode the tests always fail due to being unable to find elements but the element that it can't find always changes with each run.

When running the exact same solution not in headless mode the tests all pass as expected.

Why would this happen?

tipsey commented 1 year ago

Make sure you have this in each Test Method

using System.Drawing;

var client = new WebClient(TestSettings.Options); if (TestSettings.Options.Headless) client.Browser.Driver.Manage().Window.Size = new Size(1920, 1080);

TestSettings.cs Headless = true,