【问题标题】:Selenium IEDriver dosen't work on VPNSelenium IE 驱动程序在 VPN 上不起作用
【发布时间】:2017-01-31 06:52:03
【问题描述】:

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

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

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

注意:在调试时我注意到了,

一旦打开浏览器窗口,在 getUrl() 之后, 我试图 getCurrenturl() 并得到以下结果。 对于 IE,它提供了 initialBrowserUrl instad 的实际 Url

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/

Chrome 驱动程序日志:

[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/

【问题讨论】:

    标签: java selenium selenium-webdriver vpn selenium-iedriver


    【解决方案1】:

    您可能需要通过浏览器传递 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();
    

    【讨论】:

    • 太棒了!非常感谢..!!我已经为 IEDriver 应用了相同的设置,预计 INITIAL_BROWSER_URL 和 ENABLE_ELEMENT_CACHE_CLEANUP 所以,我刚刚添加了 INITIAL_BROWSER_URL 它对我来说非常有效。
    猜你喜欢
    • 2014-07-08
    • 1970-01-01
    • 1970-01-01
    • 2022-10-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多