selenium: [🐛 Bug]: UseWebView in EdgeOption not exists in Java
What happened?
I am running tests using Selenium and Java.
I need now to test also WebView2 application opened from the browser.
From the example in this link : https://learn.microsoft.com/en-us/microsoft-edge/webview2/how-to/webdriver
need to define the following : //Set the EdgeOptions instance to use WebView2 eo.UseWebView = true;
The problem is that this option not exists in Java. Seel also here : https://learn.microsoft.com/en-us/answers/questions/927167/how-to-click-into-browser-embedded-into-webview2-u
The Application is opened but it got stuck. How can I test WebView2 application using selenium and Java ?
How can we reproduce the issue?
EdgeOptions eo = new EdgeOptions();
eo.setBinary("C:\MyApp.exe");
eo.setCapability("useWebView", true);
EdgeDriver driver = new EdgeDriver(eo);
Relevant log output
Only local connections are allowed.
Please see https://aka.ms/WebDriverSecurity for suggestions on keeping Microsoft Edge WebDriver safe.
Microsoft Edge WebDriver was started successfully.
May 01, 2023 6:33:38 PM org.openqa.selenium.os.OsProcess destroy
INFO: Unable to drain process streams. Ignoring but the exception being swallowed follows.
org.apache.commons.exec.ExecuteException: The stop timeout of 2000 ms was exceeded (Exit value: -559038737)
at org.apache.commons.exec.PumpStreamHandler.stopThread(PumpStreamHandler.java:295)
at org.apache.commons.exec.PumpStreamHandler.stop(PumpStreamHandler.java:181)
at org.openqa.selenium.os.OsProcess.destroy(OsProcess.java:142)
at org.openqa.selenium.os.CommandLine.destroy(CommandLine.java:144)
at org.openqa.selenium.remote.service.DriverService.stop(DriverService.java:290)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:170)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:229)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:157)
at org.openqa.selenium.chromium.ChromiumDriver.(ChromiumDriver.java:101)
at org.openqa.selenium.edge.EdgeDriver.(EdgeDriver.java:60)
at org.openqa.selenium.edge.EdgeDriver.(EdgeDriver.java:56)
at org.openqa.selenium.edge.EdgeDriver.(EdgeDriver.java:48)
at com.panaya.qa.Tauri.testTauri(Tauri.java:77)
at com.panaya.qa.Tauri.main(Tauri.java:88)
May 01, 2023 6:33:38 PM org.openqa.selenium.os.OsProcess destroy
SEVERE: Unable to kill process java.lang.ProcessImpl@6cfcd46d
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: unknown error: DevToolsActivePort file doesn't exist
Host info: host: 'IDANSHAY', ip: '172.31.80.1'
Build info: version: '4.9.0', revision: 'd7057100a6'
System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_261'
Driver info: org.openqa.selenium.edge.EdgeDriver
Command: [null, newSession {capabilities=[Capabilities {browserName: MicrosoftEdge, ms:edgeOptions: {args: [--remote-allow-origins=*], binary: C:\Program Files\Locota\Loc..., extensions: []}}]}]
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:136)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:94)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:68)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:165)
at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:183)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:229)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:157)
at org.openqa.selenium.chromium.ChromiumDriver.(ChromiumDriver.java:101)
at org.openqa.selenium.edge.EdgeDriver.(EdgeDriver.java:60)
at org.openqa.selenium.edge.EdgeDriver.(EdgeDriver.java:56)
at org.openqa.selenium.edge.EdgeDriver.(EdgeDriver.java:48)
at com.panaya.qa.Tauri.testTauri(Tauri.java:77)
at com.panaya.qa.Tauri.main(Tauri.java:88)
Operating System
Windows
Selenium version
Java 4.0.0
What are the browser(s) and version(s) where you see this issue?
WebView2
What are the browser driver(s) and version(s) where you see this issue?
EdgeDriver 112
Are you using Selenium Grid?
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 33 (17 by maintainers)
Commits related to this issue
- [java] Adding userWebView2 to Java #11978 — committed to SeleniumHQ/selenium by diemol a year ago
- [javascript] Adding userWebView2 to JS #11978 — committed to SeleniumHQ/selenium by diemol a year ago
looks like python support it also :
from : https://github.com/SeleniumHQ/selenium/blob/52845c30e7f514eb6c30a0718a6bacd9c60a0ba0/py/selenium/webdriver/edge/options.py
@property def use_webview(self) -> bool: return self._use_webview