Selenium Upgrade Changes
This section provides the customizations that need to be checked and updated while migrating to DigitalWorker 24.1. If any of the. NET customizations, such as Microbots, Code Editor and custom applications are referring to Selenium version 3.141, they need to be updated to refer to Selenium version 4.18. The following are the basic modification needed in the custom code:
- Ensure the WebDriver.dll and WebDriver.Support.dll package located at the %localappdata% > EdgeVerve > AutomationStudio > bin folder is of Selenium version 4.18.
- Ensure the method of setting browser capabilities are of the new option classes like ChromeOptions, FirefoxOptions, etc. For example:
- Instead of using the DesiredCapabilities code:
DesiredCapabilities caps = new DesiredCapabilities();
caps.SetCapability("browserName", "firefox");
caps.SetCapability("platform", "Windows 10");
caps.SetCapability("version", "92");
caps.SetCapability("build", myTestBuild);
caps.SetCapability("name", myTestName);
var driver = new RemoteWebDriver(new Uri(CloudURL), caps);
- Refer to the following example that demonstrates the usage of FirefoxOptions:
FirefoxOptions browserOptions = new FirefoxOptions();
browserOptions.PlatformName = "Windows 10";
browserOptions.BrowserVersion = "92";
var cloudOptions = new Dictionary ();
cloudOptions.Add("build", myTestBuild);
cloudOptions.Add("name", myTestName);
browserOptions.AddAdditionalOption("cloud:options", cloudOptions);
WebDriver driver = new RemoteWebDriver(new Uri(CloudURL), browserOptions);
- Instead of using the DesiredCapabilities code:
- Ensure the method of browser options are of AddArgument or AddAdditionalOption method. For example:
- Instead of using AddAdditionalCapability options:
var browserOptions = new ChromeOptions();
browserOptions.PlatformName = "Windows 10";
browserOptions.BrowserVersion = "latest";
var cloudOptions = new Dictionary<string, object>();
browserOptions.AddAdditionalCapability("cloud:options", cloudOptions, true);
var driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), browserOptions);NOTE:
This method is used to add non-standard capabilities to the browser. - Use AddArgument or AddAdditionalOption:
var browserOptions = new ChromeOptions();
browserOptions.PlatformName = "Windows 10";
browserOptions.BrowserVersion = "latest";
var cloudOptions = new Dictionary ();
browserOptions.AddAdditionalOption("cloud:options", cloudOptions);
var driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), browserOptions)
- Instead of using AddAdditionalCapability options:
- Remove all references to Selenium tools for Microsoft Edge.For Example:
- Instead of using ChromiumService for Edge browser:
EdgeDriverService edgedriverService;
edgedriverService = EdgeDriverService.CreateChromiumService(msEdgeCustomDriverPath); - Use DefaultService:
EdgeDriverService edgedriverService;
edgedriverService = EdgeDriverService.CreateDefaultService(msEdgeCustomDriverPath);
- Instead of using ChromiumService for Edge browser:
- Ensure all your customizations dependencies such as Microbots, Code Editor and custom applications are compatible with Selenium 4. This also includes any third-party libraries or frameworks that you are using.