Issue
I'm setting up an Azure DEVOPS pipeline to run automated UI tests. This has mostly been a success apart from one detail.
The Azure Pipelines VM/agent doesn't have the latest MS Edge web browser version available.
Our IT policy dictates we always run the most up-to-date version of Edge, so I must run the latest version on my development machine. This means I must install the latest version of the 'Selenium.WebDriver.MSEdgeDriver' in the project.
Locally, all tests run fine.
When I run the release with the latest Selenium.WebDriver.MSEdgeDriver, I get the error:
System.InvalidOperationException : session not created: This version of Microsoft Edge WebDriver only supports Microsoft Edge version 119 Current browser version is 118.0.2088.76 with binary path C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe (SessionNotCreated)
I'm running Edge 119.0.2151.42 locally.
I downgraded Selenium.WebDriver.MSEdgeDriver to 118.0.2088.76 in the project, and now my DEVOPS Tests run as expected on the Azure Pipelines agent/VM, but of course, I can no longer run or debug the tests locally.
Is there a way in the release pipeline to upgrade edge?
I know I can create a dedicated VM and use it instead, but it seems like a waste when the functionality natively exists in Azure.
Is there another way, something I'm missing?
Solution
Not sure how you are managing your browser drivers, but am guessing you are manually setting the edgedriver.exe
path.
If this is true, why don't you let selenium decide which EdgeDriver
it should use depending on the Edge browser on your system. This way, it will use edge driver 118
in your Azure VM and edge driver 119
in your local system.
And to achieve the above, you just need to make sure you are using latest selenium(v4.6.0
or above). Use latest(v4.15
) if possible.
You don't need to set the path/location of driver.exe
. Code can be as simple as below.
Python code:
from selenium import webdriver
driver = webdriver.Edge()
driver.get("https://stackoverflow.com/")
driver.quit()
Java code:
WebDriver driver = new EdgeDriver();
driver.get("https://stackoverflow.com/");
driver.quit();
C# Code:
IWebDriver driver = new EdgeDriver();
driver.Navigate().GoToUrl("https://stackoverflow.com/");
driver.Quit();
To know more about Selenium Manager, refer links below:
- https://stackoverflow.com/a/76574264/7598774
- https://stackoverflow.com/a/76463081/7598774
- Selenium Manager
Answered By - Shawn
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.