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!
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
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)
- 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