Problem
Getting blank edge page with address as data while setting up UI automation solution with below stack.
Stack
Trying to create a UI Automation - with Selemium VS 2019, Edge Chromium version: 87.0.664.47
Microsoft.Edge.SeleniumTools:3.141.2
Selenium.WebDriver: 3.141.0 - which is compatible with Microsoft.Edge.SeleniumTools.
EdgeOptions op = new EdgeOptions();
//op.UseChromium = true;
string location = #"C:\drivers\";
EdgeDriver d = new EdgeDriver(location, op);
d.Navigate().GoToUrl("https://www.google.com/");
d.Manage().Window.Maximize();
Blank edge page with data:
This line can be modified:
d.Navigate().GoToUrl("https://www.google.com/");
Take out the Navigate() so it is just
d.Url = #"https://www.google.com";
Also not sure why you have commented out d.UseChromium = true; as that is required in order to use Chromium edge. Otherwise it will load the legacy browser.
Related
I have a requirement to switch from chrome to edge driver chromium
I am having issues trying to launch the browser as a different user. We need to open the browser with different users who have different roles and validate
To manually do this you would right click edge browser > shift and click Microsoft edge > Run as different user
I am using the following NuGet Packages:
MicrosoftEdge.SeleniumTools 3.141.2
Selenium.Webdriver 3.141.0
Microsoft Edge version
91.0.864.54
Previously with using chrome and the package Selenium.Chrome.Webdriver i was able to use the following
service.StartupDomain = ""
service.StartupUserName = ""
service.StartupPassword = ""
service.StartupLoadUserProfile = true;
However with MicrosoftEdge.SeleniumTools 3.141.2 i am unable to find a similar solutions. Does anyone know an equivalent solution?
Current code below
EdgeDriverService service = EdgeDriverService.CreateChromiumService(driverpath, msedgedriverExe);
var edgeOptions = new EdgeOptions();
edgeOptions.UseChromium = true;
service. ???
edgeOptions. ???
IWebDriver driver = new EdgeDriver(service, options)
It appears that the version of Selenium included with Atata does not support the EdgeOption "UseChromium", and when I try to use the Edge Driver, the test run fails unless I rename the driver in the bin\Debug\netcoreapp2.1\drivers\edge\91.0.864.41 folder from "msedgedriver.exe" to "MicrosoftWebDriver.exe", which leads me to believe it's trying to run the old non-chromium Edge - is there some way to get this working?
In order to use Chromium Edge with Atata:
Update Selenium.WebDriver package to 4.0.0-beta2 version.
Change Atata configuration to:
AtataContext.GlobalConfiguration
.UseDriver(() =>
{
EdgeOptions options = new EdgeOptions
{
UseChromium = true
};
// Headless options:
//options.AddArguments("headless", "disable-gpu", "window-size=1024,768");
return new EdgeDriver(options);
})
Atata Samples / Using Headless Edge sample might also help.
For an automation project I have to use selenium webdriver with edge. Unfortunately the site is under IE kernel. So I start edge in IE mode everything works fine. But when the controller needs to detect a new window with windowHandle, it does not detect anything new even with a wait.
Is it possible to make the switch work in IE mode ?
PS: As I use an IE driver I can by changing a few lines start IE. When I run IE the window change is done. When I run Edge with the options I don't detect anything. So everything works fine with the IE browser, the problem only comes from edge and the IE mod.
I am using an IE driver with capabilities like this :
var ieService = InternetExplorerDriverService.CreateDefaultService(dir, driver);
var ieOptions = new InternetExplorerOptions{};
ieOptions.AddAdditionalCapability("ie.edgechromium", true);
ieOptions.AddAdditionalCapability("ie.edgepath", "{path to msedge.exe}");
var webdriver = new InternetExplorerDriver(ieService, ieOptions, TimeSpan.FromSeconds(30));
driver.FindElement(By.Id("button")).Click();
Thread.Sleep(2000);
string popupHandle = string.Empty;
ReadOnlyCollection<string> windowHandles = driver.WindowHandles;
foreach (string handle in windowHandles)
{
if (handle != existingWindowHandle)
{
popupHandle = handle;
break;
}
}
driver.SwitchTo().Window(popupHandle);
Now it is solved. You can download latest Selenium version 4.0 and start scripting for Edge in IE Mode. You can also follow the issue ticket in github in the following link MS Edge in IE Mode
I am using the below VB.NET code op open Edge Chromium(In IE Capability Mode). It works if there are no existing Edge windows open, Other wise, it just opens another tab in the existing window and just displays This is the initial start page for the WebDriver server. and nothing happens (see screenshot below)
Dim ieService = InternetExplorerDriverService.CreateDefaultService(Environment.CurrentDirectory, "IEDriverServer.exe")
Dim ieOptions = New InternetExplorerOptions
ieOptions.IgnoreZoomLevel = True
ieOptions.AddAdditionalCapability("ie.edgechromium", True)
ieOptions.AddAdditionalCapability("ie.edgepath", "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe")
Dim driver = New InternetExplorerDriver(ieService, ieOptions, TimeSpan.FromSeconds(60))
driver.Navigate().GoToUrl("https://example.com")
After one minute, it throws below exception at the line Dim driver = New InternetExplorerDriver(ieService, ieOptions, TimeSpan.FromSeconds(60))
OpenQA.Selenium.WebDriverException: 'The HTTP request to the remote
WebDriver server for URL http://localhost:52074/session timed out
after 60 seconds.'
Do anyone know how to fix this? (I don't want to kill edge sessions first and then start, because i want the are existing edge windows untouched)
To automate Edge-IE in already opened Edge browser window. Please follow the below steps
Include the application you are trying to launch in Edge-IE browser to the compatibility list of Edge browser(edge://compat)
Include the below command line to start an Edge process before calling Edge-IE driver initialization
code sample
System.Diagnostics.Process.Start(#"msedge.exe", "https://google.com/");
Thread.Sleep(1000);
var dir = "//path of your Edgedriver";
var driver = "IEDriverServer.exe";
if (!Directory.Exists(dir) || !File.Exists(Path.Combine(dir, driver))){
Console.WriteLine("Failed to find {0} in {1} folder.", dir, driver);}
var ieService = InternetExplorerDriverService.CreateDefaultService(dir, driver);
var ieOptions = new InternetExplorerOptions { };
ieOptions.AddAdditionalCapability("ie.edgechromium", true);
ieOptions.AddAdditionalCapability("ie.edgepath", #"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe");
InternetExplorerDriver webdriver = new InternetExplorerDriver(ieService, ieOptions, TimeSpan.FromMinutes(3));
I am running coded ui test in Chrome browse.In Web application we have one link in grid and we have to click on that link. Same test is working fine in IE but in Chrome it is giving excpetion playback can not find control with technology name=MSAA and Control type=window
i have used below code:
if (ConfigurationManager.AppSettings["Driver"] == "IE")
{
BrowserWindow br = new BrowserWindow();
HtmlHyperlink href1 = new HtmlHyperlink(br);
href1.SearchProperties.Add
(
HtmlHyperlink.PropertyNames.InnerText,
"link"
);
Mouse.Click(href1);
}
else
{
BrowserWindow br = new BrowserWindow();
string CT = br.ControlType.ToString();
string Tn = br.TechnologyName.ToString();
UITestControl Window = new UITestControl(br);
Window.TechnologyName = "MSAA";
Window.SearchProperties[UITestControl.PropertyNames.Name] = "link";
Window.SearchProperties[UITestControl.PropertyNames.ClassName] = "standardURL";
//link
UITestControl link = new WinHyperlink(Window);
link.SearchProperties[UITestControl.PropertyNames.ControlType] = "Window";
Mouse.Click(link);
}
In IE execution that link is serchable and clickable with property innertext but in chrome it is not...also tried adding friendlyname but no luck..please suggest....Now i am in impression is like whether coded ui runs in chrome or not
You cannot record coded UI tests using Google Chrome or Mozilla Firefox browsers. To play back tests on non-IE web browsers, you must install the Selenium components for Coded UI Cross Browser Testing.
https://msdn.microsoft.com/en-us/library/jj835758.aspx