Forum Discussion
Chromium Edge automation with selenium (best practice)
- Jul 18, 2019
johnjansen actually it do not open with the edge:
i installed Edge dev Version 77.0.211.3, and Edge Canary Version 77.0.218.4 too. And I use the Version: 77.0.219.0 driver. My test open chrome, not edge. I tried with chromeoption, with System.setProperty, but still. Can you help me what I do wrong? Thanks!
- johnjansenApr 06, 2020Former Employee
PraveenRaj13 did you try this?
options.AddUserProfilePreference("credentials_enable_service", false); options.AddUserProfilePreference("profile.password_manager_enabled", false);-John
- PraveenRaj13Apr 06, 2020Copper ContributorHi dude
Any update on this issue - PraveenRaj13Apr 01, 2020Copper Contributor
Thank u john
we are getting struck with disable save password POP up .unable to disable this pop i tryed with below capabilities but its not working so kindly help us
edgeOptions.setExperimentalOption("credentials_enable_service", false);
edgeOptions.setExperimentalOption("profile.password_manager_enabled", false); - johnjansenMar 19, 2020Former Employee
PraveenRaj13 this article should be able to help you. It has information for different versions of Selenium and WebDriver, though 2.53 is too old - it does not have any knowledge of Microsoft Edge, unfortunately.
https://docs.microsoft.com/en-us/microsoft-edge/webdriver-chromium
-John
- PraveenRaj13Mar 19, 2020Copper Contributor
thank u so much. I'm able to do navigate browser is there any possibility to use selenium 2.53 version or what are the versions support for selenium for this please give your solution
- leiwangMar 19, 2020Copper Contributor
This problem is very probably related to the Microsoft Chromium Edge's version, before version 80, you can treat it like a chrome browser; but from version 80 you have to use EdgeDriver and EdgeOptions to handle it.
See my detail explanation at stackoverflow
https://stackoverflow.com/questions/59299282/how-to-remove-the-infobar-microsoft-edge-is-being-controlled-by-automated-test/60111307#60111307
- PraveenRaj13Mar 19, 2020Copper Contributor
does not work please have u look my code and provide some solution
ChromeOptions co=new ChromeOptions();
System.setProperty("webdriver.edge.driver", "C:\\Users\\pceqa\\Downloads\\edgedriver_win64\\msedgedriver.exe");
co.setBinary("C:\\Program Files (x86)\\Microsoft\\Edge Beta\\Application\\msedge.exe");
co.setExperimentalOption("useAutomationExtension", false);
co.setExperimentalOption("excludeSwitches", Collections.singletonList("enable-automation"));final EdgeOptions edgeOptions = new EdgeOptions().merge(co);
final WebDriver webDriver = new EdgeDriver(edgeOptions);
my exception :
Starting MSEdgeDriver 81.0.416.34 (03120a7eee79e003b101978167af19f238dd1de0) on port 31062
Only local connections are allowed.
Please protect ports used by MSEdgeDriver and related test frameworks to prevent access by malicious code.
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: session not created: No matching capabilities found
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
os.version: '6.1', java.version: '1.8.0_73'
Driver info: driver.version: EdgeDriver
remote stacktrace: Backtrace:
Ordinal0 [0x000000013F8F6DC2+3239362]
Ordinal0 [0x000000013F7E8C62+2133090]
Ordinal0 [0x000000013F6927A4+731044]
Ordinal0 [0x000000013F61EABA+256698]
Ordinal0 [0x000000013F61E3BE+254910]
Ordinal0 [0x000000013F61FA01+260609]
Ordinal0 [0x000000013F61CB9F+248735]
Ordinal0 [0x000000013F5FA1A3+106915]
Ordinal0 [0x000000013F5FB50E+111886]
Ordinal0 [0x000000013F804781+2246529]
GetHandleVerifier [0x000000013F9D5454+767796]
GetHandleVerifier [0x000000013F9D5211+767217]
GetHandleVerifier [0x000000013F9EDFF1+869073]
GetHandleVerifier [0x000000013F9D5CB7+769943]
Ordinal0 [0x000000013F7FA314+2204436]
Ordinal0 [0x000000013F80665E+2254430]
Ordinal0 [0x000000013F824711+2377489]
BaseThreadInitThunk [0x000000007716556D+13]
RtlUserThreadStart [0x00000000773C372D+29]at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$errorHandler$0(W3CHandshakeResponse.java:62)
at org.openqa.selenium.remote.HandshakeResponse.lambda$getResponseFunction$0(HandshakeResponse.java:30)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:126)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:128)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:74)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:141)
at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:130)
at edge.edgebrowser.main(edgebrowser.java:36) - PraveenRaj13Mar 19, 2020Copper Contributor
it does not work me iam tryed your code my details slelenium verstions 3.141.59
edge chromium browser version is 81.0.416.34 (Official build) beta (64-bit)
windows 7 os
my code
ChromeOptions co=new ChromeOptions();
System.setProperty("webdriver.edge.driver", "C:\\Users\\pceqa\\Downloads\\edgedriver_win64\\msedgedriver.exe");co.setBinary("C:\\Program Files (x86)\\Microsoft\\Edge Beta\\Application\\msedge.exe");
co.setExperimentalOption("useAutomationExtension", false);
co.setExperimentalOption("excludeSwitches", Collections.singletonList("enable-automation"));final EdgeOptions edgeOptions = new EdgeOptions().merge(co);
final WebDriver webDriver = new EdgeDriver(edgeOptions);
exception is :
Starting MSEdgeDriver 81.0.416.34 (03120a7eee79e003b101978167af19f238dd1de0) on port 31062
Only local connections are allowed.
Please protect ports used by MSEdgeDriver and related test frameworks to prevent access by malicious code.
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: session not created: No matching capabilities found
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
os.version: '6.1', java.version: '1.8.0_73'
Driver info: driver.version: EdgeDriver
remote stacktrace: Backtrace:
Ordinal0 [0x000000013F8F6DC2+3239362]
Ordinal0 [0x000000013F7E8C62+2133090]
Ordinal0 [0x000000013F6927A4+731044]
Ordinal0 [0x000000013F61EABA+256698]
Ordinal0 [0x000000013F61E3BE+254910]
Ordinal0 [0x000000013F61FA01+260609]
Ordinal0 [0x000000013F61CB9F+248735]
Ordinal0 [0x000000013F5FA1A3+106915]
Ordinal0 [0x000000013F5FB50E+111886]
Ordinal0 [0x000000013F804781+2246529]
GetHandleVerifier [0x000000013F9D5454+767796]
GetHandleVerifier [0x000000013F9D5211+767217]
GetHandleVerifier [0x000000013F9EDFF1+869073]
GetHandleVerifier [0x000000013F9D5CB7+769943]
Ordinal0 [0x000000013F7FA314+2204436]
Ordinal0 [0x000000013F80665E+2254430]
Ordinal0 [0x000000013F824711+2377489]
BaseThreadInitThunk [0x000000007716556D+13]
RtlUserThreadStart [0x00000000773C372D+29]at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$errorHandler$0(W3CHandshakeResponse.java:62)
at org.openqa.selenium.remote.HandshakeResponse.lambda$getResponseFunction$0(HandshakeResponse.java:30)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:126)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:128)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:74)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:141)
at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:130)
at edge.edgebrowser.main(edgebrowser.java:36) - ChrisCSQSJan 24, 2020Copper Contributor
- johnjansenJan 14, 2020Former Employee
nhatekar yes. Really the best way is to update to the Alpha build of Selenium 4 because that's where we updated Selenium to recognize the new Edge browser.
Here is just a quick C# example that works with Selenium 4 (you can get it from nuget or here:
// EdgeOptions() requires using OpenQA.Selenium.Edge // Construct EdgeOptions with is_legacy = false var edgeOptions = new EdgeOptions(false); edgeOptions.BinaryLocation = @"C:\Program Files (x86)\Microsoft\Edge Dev\Application\msedge.exe"; var msedgedriverDir = @"c:\drivers"; var msedgedriverExe = @"msedgedriver.exe"; // Construct EdgeDriverService with is_legacy = false too var service = EdgeDriverService.CreateDefaultService(msedgedriverDir, msedgedriverExe, false); service.EnableVerboseLogging = true; var driver = new EdgeDriver(service, edgeOptions); driver.Url = "http://www.example.com"; - nhatekarJan 13, 2020Copper Contributor
Is there a straight forward way to use and launch the Edge Chromium driver with Selenium? Thank you.
- carlbc18Dec 18, 2019Copper Contributor
I'm able to get chromium edge to launch with setting the webdriver.chrome.driver property to that of the edge driver (appropriately downloaded for the version i'm using), however, I receive a timeout, which force closes the browser. The browser immediately reopens and continues on, but the initial instance is killed off.
Other code which has worked for me is:
System.setProperty("webdriver.edge.driver", "Path to > msedgedriver.exe"); // Setup the Edge chromium driver options for this operating system final ChromeOptions chromeOptions = new ChromeOptions(); chromeOptions.setBinary(applicationPath); chromeOptions.setExperimentalOption("useAutomationExtension", false); chromeOptions.setExperimentalOption("excludeSwitches", Collections.singletonList("enable-automation")); final EdgeOptions edgeOptions = new EdgeOptions().merge(chromeOptions); final WebDriver webDriver = new EdgeDriver(edgeOptions); - leiwangDec 18, 2019Copper Contributor
Does "using ChromeDriver and setting the "webdriver.chrome.driver" property" still work?
I am using "chromium edge" Version 80.0.361.5 (Official build) dev (64-bit) and selenium 3.14.0, I doesn't work.
I started the "selenium server" with option -Dwebdriver.chrome.driver="pathTo\msedgedriver.exe"
I added the folder containing Edge executable "msedge.exe" on the environment PATH
Then I ran the following code, but it failed
System.setProperty("webdriver.chrome.driver", "C:\\SeleniumPlus\\extra\\msedgedriver.exe"); DesiredCapabilities m_capability = DesiredCapabilities.chrome();m_capability.setCapability(CapabilityType.BROWSER_NAME, BrowserType.CHROME); WebDriver driver = new ChromeDriver(m_capability);
I tried another way and it worked for me:
I started the "selenium server" with option -Dwebdriver.edge.driver="pathTo\msedgedriver.exe"
I added the folder containing Edge executable "msedge.exe" on the environment PATH
System.setProperty("webdriver.edge.driver", "C:\\SeleniumPlus\\extra\\msedgedriver.exe"); DesiredCapabilities m_capability = DesiredCapabilities.edge(); WebDriver driver = new EdgeDriver(m_capability);
new EdgeDriver(m_capability); is deprecated, we can use the RemoteWebDriver instead as below:
driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), m_capability);
Now I'm having a question, I can we set the "experimental options" for "Chromium Edge"? I asked the same question on stackoverflow at https://stackoverflow.com/questions/59299282/how-to-remove-the-infobar-microsoft-edge-is-being-controlled-by-automated-test
- PrasanthRVNov 28, 2019Copper Contributor
Team , I am unable to run the selenium tests in Chrome and Edge(Chromium) in parallel mode . Separately , I am able to execute tests in either of the browsers , but in parallel mode ,only one test is getting succeeded.
- johnjansenJul 22, 2019Former Employee
mmiky123 Yes, that's correct. Each browser must have it's own Driver that specifically runs that version of the browser. So if you want to automate the Old Edge, you'd use MicrosoftWebDriver. If you want to automate the new Edge, you'd use MSEdgeDriver (and for the time being, tell it where to find the EXE to launch msedge.exe instead of chrome.exe).
- mmiky123Jul 21, 2019Copper ContributorHi. So it looks like the chromium edge driver is specifically tailored to chromium edge and its functionality, so it is by default searching for a chromium edge installation. From there it is just like the chromedriver with its functionality.
- johnjansenJul 16, 2019Former Employee
aseema31 for the time being (hopefully not too much longer), yes, sort-of. You want to use the Chrome* classes and explicitly point them to the msedge on your machine. When the language bindings are all updated and stable, then you can rename to use Edge* classes.
Here is a code sample in C# for what I mean:
var anaheimService = ChromeDriverService.CreateDefaultService(@"c:\drivers", "msedgedriver.exe"); var anaheimOptions = new ChromeOptions { BinaryLocation = @"C:\Users\johnjan\AppData\Local\Microsoft\Edge SxS\Application\msedge.exe" }; //anaheimOptions.AddArgument("--headless"); driver = new ChromeDriver(anaheimService, anaheimOptions); - aseema31Jul 16, 2019Copper Contributor
mmiky123
Please help me understand here, the only action taken here is to rename msedgedriver.exe to chromedriver.exe? Rest entire code remains the same as if we were using chromedriver? If so is the case can you please help me understand what to expect when we launch broswer
? Are we expecting chrome or edge to launch when ran in non headless mode?
Thank you - BPascalApr 29, 2019Copper ContributorIt works fine with Java bindings using ChromeDriver and setting the "webdriver.chrome.driver" property.
- johnjansenApr 26, 2019Former Employee
mmiky123 glad to hear that. Yeah, we need to get our language bindings merged into Selenium to avoid the rename. I forgot to mention that. Glad your test worked, though!