我正在边缘浏览器中使用 IE 模式测试 Web 自动化脚本我正在使用 4.8.1 IE 驱动程序 32 位,selenium 4.0.1 对我来说工作得很好但是当我最小化屏幕或锁定屏幕时它会坚持只初始化浏览器页面
公共类 AlertPopUp {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.ie.driver", "D:\\AlertPopUp\\IEDriverServer.exe");
RemoteWebDriver driver = null;
try {
InternetExplorerOptions ieOptions = new InternetExplorerOptions();
ieOptions.attachToEdgeChrome();
ieOptions.withEdgeExecutablePath("C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe");
ieOptions.requireWindowFocus();
ieOptions.setCapability("ignoreProtectedModeSettings", true);
ieOptions.ignoreZoomSettings();
ieOptions.destructivelyEnsureCleanSession();
ieOptions.setCapability (InternetExplorerDriver.ENABLE_PERSISTENT_HOVERING, false) ;
ieOptions.setCapability ("disable-popup-blocking", true);
driver = new InternetExplorerDriver(ieOptions);
driver.manage().window().maximize();
driver.get("https://www.google.com/");
driver.quit();
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}
} 例外:- 已启动 InternetExplorerDriver 服务器(32 位) 4.8.1.0 监听端口 29726 只允许本地连接 org.openqa.selenium.SessionNotCreatedException:无法启动新会话。可能的原因是远程服务器地址无效或浏览器启动失败。 主机信息:主机:'AJAX',ip:'192.168.0.106' 构建信息:版本:“4.8.0”,修订版:“267030adea” 系统信息:os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.4.1' 驱动信息:org.openqa.selenium.ie.InternetExplorerDriver 命令:[null, newSession {capabilities=[Capabilities {browserName: internet explorer, disable-popup-blocking: true, se:ieOptions: {enablePersistentHover: false, ie.edgechromium: true, ie.edgepath: C:\Program Files ( x86)\Micr..., ignoreProtectedModeSettings: true, ignoreZoomSetting: true, requireWindowFocus: true}}], desiredCapabilities=Capabilities {browserName: internet explorer, disable-popup-blocking: true, se:ieOptions: {enablePersistentHover: false, 即.edgechromium: true, ie.edgepath: C:\Program Files (x86)\Micr..., ignoreProtectedModeSettings: true, ignoreZoomSetting: true, requireWindowFocus: true}}}] 能力{} 在 org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:561) 在 org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:229) 在 org.openqa.selenium.ie.InternetExplorerDriver.run(InternetExplorerDriver.java:153) 在 org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:140) 在 org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:117) 在 testpopup.AlertPopUp.main(AlertPopUp.java:42) Caused by: java.lang.RuntimeException: NettyHttpHandler请求执行错误 在 org.openqa.selenium.remote.http.netty.NettyHttpHandler.makeCall(NettyHttpHandler.java:76) 在 org.openqa.selenium.remote.http.AddSeleniumUserAgent.lambda$apply$0(AddSeleniumUserAgent.java:42) 在 org.openqa.selenium.remote.http.Filter.lambda$andFinally$1(Filter.java:56) 在 org.openqa.selenium.remote.http.netty.NettyHttpHandler.execute(NettyHttpHandler.java:49) 在 org.openqa.selenium.remote.http.AddSeleniumUserAgent.lambda$apply$0(AddSeleniumUserAgent.java:42) 在 org.openqa.selenium.remote.http.Filter.lambda$andFinally$1(Filter.java:56) 在 org.openqa.selenium.remote.http.netty.NettyClient.execute(NettyClient.java:99) 在 org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:124) 在 org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:106) 在 org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:67) 在 org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:156) 在 org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:167) 在 org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:142) 在 org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543) ... 还有 5 个 由以下原因引起:java.util.concurrent.ExecutionException:java.util.concurrent.TimeoutException:180000 毫秒后请求超时到 localhost/127.0.0.1:29726 在 java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396) 在 java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2096) 在 org.asynchttpclient.netty.NettyResponseFuture.get(NettyResponseFuture.java:206) 在 org.openqa.selenium.remote.http.netty.NettyHttpHandler.makeCall(NettyHttpHandler.java:59) ... 18 更多 由以下原因引起:java.util.concurrent.TimeoutException:180000 毫秒后请求超时到 localhost/127.0.0.1:29726 在 org.asynchttpclient.netty.timeout.TimeoutTimerTask.expire(TimeoutTimerTask.java:43) 在 org.asynchttpclient.netty.timeout.RequestTimeoutTimerTask.run(RequestTimeoutTimerTask.java:50) 在 io.netty.util.HashedWheelTimer$HashedWheelTimeout.run(HashedWheelTimer.java:715) 在 io.netty.util.concurrent.ImmediateExecutor.execute(ImmediateExecutor.java:34) 在 io.netty.util.HashedWheelTimer$HashedWheelTimeout.expire(HashedWheelTimer.java:703) 在 io.netty.util.HashedWheelTimer$HashedWheelBucket.expireTimeouts(HashedWheelTimer.java:790) 在 io.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:503) 在 io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) 在 java.base/java.lang.Thread.run(Thread.java:833)