Selenium IE 驱动程序不适用于 VPN

Selenium IEDriver dosen't work on VPN

我的 selenium 脚本适用于驱动程序 Chromedriver 和 IEDriver 当我没有连接到 VPN 时。

但是当我尝试 运行 相同的脚本时 当我连接到 VPN 它仅适用于 Chromedriver, 对于 IEDriver 只需打开浏览器,最大化,获取 URL 然后 所有场景都被跳过并出现以下错误。

org.openqa.selenium.NoSuchWindowException:无法获取浏览器(警告:服务器未提供任何堆栈跟踪信息) 命令持续时间或超时:17 毫秒

注意:调试时我注意到,

在 getUrl() 之后一旦浏览器 window 打开, 我尝试 getCurrenturl() 并得到以下结果。 对于 IE,它给出了实际 Url.

的 initialBrowserUrl

IEDriver 日志:

[testng]Started InternetExplorerDriver server (32-bit)
[testng] 2.53.1.0
[testng] Listening on port 28196
[testng] Only local connections are allowed
[testng] Actual URL url : mydomain.com/XYZApplication/
[testng] getCurrenturl (driver.getCurrenturl): localhost:28196/

Chromedriver 日志:

[testng] Starting ChromeDriver 2.23.409699 (49b0fa931cda1caad0ae15b7d1b68004acd05129) on port 8160
[testng] Only local connections are allowed.
[testng] test url : mydomain.com/XYZApplication/
[testng] getCurrenturl (driver.getCurrenturl) : mydomain.com/XYZApplication/

您可能需要在浏览器中传递 IE 首选项。堆栈跟踪非常开放,所以我不确定问题是什么。由于我 运行 进入的 IE 问题,以下是我在去年设置的一些首选项。如果没有 VPN

,您可能不需要这些
        DesiredCapabilities caps = DesiredCapabilities.internetExplorer();
        caps.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
        caps.setCapability(InternetExplorerDriver.INITIAL_BROWSER_URL, " mydomain.com/XYZApplication/");
        caps.setCapability(InternetExplorerDriver.ENABLE_ELEMENT_CACHE_CLEANUP, true);
        caps.setCapability("ignoreProtectedModeSettings", true);
        caps.setCapability("ignoreZoomSetting", true);
caps.setCapability("nativeEvents", false);
        caps.setCapability(CapabilityType.ForSeleniumServer.ENSURING_CLEAN_SESSION, true); 
        caps.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true); 
        caps.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR, UnexpectedAlertBehaviour.ACCEPT);

        driver = new InternetExplorerDriver(caps);
        driver.manage().window().maximize();