microsoft / EasyRepro

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

[FEATURE] Specify Web Drivers File Name #1248

Open ejueldotnet opened 2 years ago

ejueldotnet commented 2 years ago

Describe the feature
Requesting improvement to BrowserDriverFactory.cs to use a new BrowserOptions parameter that specifies the driver executable file name when calling the various DriverService.CreateDefaultService functions.

example:

var edgeService = string.IsNullOrWhiteSpace(options.DriversExecutable) ? EdgeDriverService.CreateDefaultService(options.DriversPath) : EdgeDriverService.CreateDefaultService(options.DriversPath, options.DriversExecutable);`

Explain why this feature is needed
EasyRepro BrowserDriverFactory.cs currently only passes the DriversPath into the Selenium CreateDefaultService function, however CreateDefaultService supports a second string parameter for specifying the driver executable file name.

Azure Pipeline Agent's have built in WebDriver executables that stay in sync with the built in browser, however the webdriver file name cannot be modified from their the defaults (ex: "chromedriver.exe" or "msedgedriver.exe") which do not match the default file names assumed by Selenium (ex: "MicrosoftWebDriver.exe" for Edge).

Additional context
Tests currently throw exception in pipeline if passing exe in path name:

Test method Dynamics365.UIAutomation.Tests.Create.CreateTests threw exception: OpenQA.Selenium.DriverServiceNotFoundException: The file C:\SeleniumWebDrivers\EdgeWebDriver\msedgedriver.exe\MicrosoftWebDriver.exe does not exist. The driver can be downloaded at http://go.microsoft.com/fwlink/?LinkId=619687

Currently the only way to specify the webdriver is to remove the EasyRepro CreateWebDriver function in tests and rebuild the logic from scratch using Selenium.

Shakevg commented 2 years ago

@zekeinclusa Do you want to use Edge Chromium? If yes it should be feature to support Edge Chromium because of the current implementation for old Edge (non-Chromium).

ejueldotnet commented 2 years ago

@shakevg, I currently run tests for both Edge (version 96.0.1054.29) and Chrome (96.0.4664.45).

Are you saying there's an existing feature to specify the webdriver executable file name?

Shakevg commented 2 years ago

@zekeinclusa I just say that ability to specify driver file name is not the right solution. The current implementation for Edge is expected and will work only with old Edge driver MicrosoftWebDriver.exe . For using Edge Chromium msedgedriver.exe new method should be implemented in EasyRepro (just changing the file name is not enough, because they are different, diff compatibilities, etc...) I will try to upload the implementation for Chromium Edge soon.

ejueldotnet commented 2 years ago

@Shakevg Sounds good, thanks for looking into this.

FYI, pulling the repo and manually setting the file name using the Edge Chromium driver worked for the tests I've been running, albeit with a few long pauses. Biggest downside is maintaining my own branch and manually rebasing latest changes from GitHub.

There are a few steps early on that stop and wait until DefaultTimeout expires (likely waiting for elements unique to the old Edge), but the tests continue and pass. Tests are performing basic actions like Navigation (open app/subArea), CommandBar click command, entity (set value, select tab, etc.).