I would like to ask a question on EdgeOptions class.
I see that the DesiredCapabilities class has been obsolete or deprecated from selenium in favor of the BrowerOptions (i.e. EdgeOption. ChromeOptions, FirefoxOptions).
Now I've tried to do remote cross browser testing with Edge, chrome and firefox. With the Firefox and chrome the cross testing work so well but neither with edge i'm getting this error message"OneTimeSetUp: OpenQA.Selenium.WebDriverException : Error forwarding the new session cannot find : Capabilities {browserName: Edge, ms:extensionPaths: [C:\Program Files (x86)\Micr...], platformName: windows}".
Remote Selenium Hub is running up and node is registered but on checking the grid console(https://localhost:4444/grid/console), I can only seee that no edge browser is displayed. So I tried the following command"java -jar selenium-server-standalone-3.141.59.jar -role webdriver -hub http://10.8.106.66:4444/wd/hub -port 53244 -browser browserName=microsoftedge,maxInstances=1,platform=WINDOWS -browser browserName=chrome,maxInstances=1,platform=WINDOWS -browser browserName=firefox,maxInstances=1,platform=WINDOWS" and can still when do Grid console(https://localhost:4444/grid/console) still can see internet explorer and the same error message"OneTimeSetUp: OpenQA.Selenium.WebDriverException : Error forwarding the new session cannot find : Capabilities {browserName: Edge, ms:extensionPaths: [C:\Program Files (x86)\Micr...], platformName: windows}".
The selenium grid version is 3.141.59
Please help. The script class where Edge error is encountered is:
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Support.UI;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Edge;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Remote;
using SeleniumExtras.WaitHelpers;
using SeleniumExtras.PageObjects;
using System;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using POM_API;
namespace POM_Web_EXE
{
[TestFixture("Chrome"/, " 97.0.4606.61"//, "windows" /)]
[TestFixture("Firefox"/, "92.0.1"//, "windows"/)]
[TestFixture("MicrosoftEdge"/, "94.0.992.31"//, "windows"/)]
[Parallelizable(ParallelScope.All)]
public class POM_Web_CrossTest
{
HomePage_API apiHomeInstance;
SearchPage_API apiSearchInstance;
string expectedHomeWebTittle = "Google";
string search_key = "LamdaTest";
IWebDriver driver;
public string browse;
//string version;
//string os;
public POM_Web_CrossTest(string browser/*, string version*//*, string os*/)
{
this.browse = browser;
//this.version = version;
//this.os = os;
}
[OneTimeSetUp]
public void Setup()
{
switch (browse)
{
case "MicrosoftEdge":
//Local webdrive
driver = new EdgeDriver("C:\\Program Files (x86)\\Microsoft\\Edge\\Application");
driver.Manage().Window.Maximize();
break;
case "Firefox":
//Local webdrive
driver = new FirefoxDriver("C:\\Program Files\\Mozilla Firefox");
driver.Manage().Window.Maximize();
break;
case "Chrome":
//Local webdrive
driver = new ChromeDriver("C:\\Program Files\\Google\\Chrome\\Application");
driver.Manage().Window.Maximize();
break;
default:
break;
}
}
[Test, Order(1)]
public void HonePage()
{
Console.WriteLine("browse:= " + browse/* + " version := " + version + " os := " + os*/);
apiHomeInstance = new HomePage_API(driver);
apiHomeInstance.GotoWebpage();
async void TaskDelay()
{
await Task.Delay(300);
}
TaskDelay();
if (expectedHomeWebTittle == apiHomeInstance.GetCurPageTitle())
{
Assert.AreEqual(expectedHomeWebTittle, apiHomeInstance.GetCurPageTitle());
Console.WriteLine("Expected Home Target Page Tittle Passed");
}
TaskDelay();
Assert.AreEqual(true, apiHomeInstance.GetWebPageLogo());
Console.WriteLine(apiHomeInstance.SearchKey());
TaskDelay();
apiHomeInstance.SearchKeyWord(search_key);
}
[Test, Order(2)]
public void Search_WebPage()
{
apiSearchInstance = new SearchPage_API(driver);
//expected target page
string expectTargetPageTitle = "Most Powerful Cross Browser Testing Tool Online | LambdaTest";
FinalPageManipulation_Load_API clickTargetlink = apiSearchInstance.ClickFinalTargetLink();
//Final manipulation of the target page
Assert.AreEqual(true, clickTargetlink.finalLogoDisplay());
Assert.AreEqual(expectTargetPageTitle, clickTargetlink.getWebtitle());
if (expectTargetPageTitle == clickTargetlink.getWebtitle())
{
Console.WriteLine("Expected main Target Page Tittle Passed");
}
Assert.AreEqual(true, clickTargetlink.FinalPageRelease());
}
[OneTimeTearDown]
public void End_POM_EXE()
{
async void TaskDelay()
{
await Task.Delay(300);
}
bool passedResults = TestContext.CurrentContext.Result.Outcome.Status == NUnit.Framework.Interfaces.TestStatus.Passed;
try
{
((IJavaScriptExecutor)driver).ExecuteScript("LamdaTest status " + (passedResults ? "Passed" : "Failed"));
}
finally
{
TaskDelay();
driver.Quit();
}
}
}
}