Devang Thakrar Devang Thakrar - 2 months ago 21
Java Question

Selenium IEDriver dosen't work on VPN

My selenium script work on both driver Chromedriver , IEDriver
When I'm not connected to VPN.

But when i try to run same script while i'm connected to VPN
It works with Chromedriver only ,
For IEDriver just browser open , maximized , get URL and after that
all scenarios get skipped with below error.

org.openqa.selenium.NoSuchWindowException: Unable to get browser (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 17 milliseconds

Note : While Debugging i noticed that,

After getUrl() once browser window is opened,
I tried to getCurrenturl() and got Following result.
For IE it gives initialBrowserUrl instad of actual Url.

IEDriver logs:

[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 logs:

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

Answer

You may need to pass IE preferences in with your browser. The stack trace is very open-ended so I'm not sure what the issues is. Here are some preferences I have set from over the last year due to issues with IE I ran into. You may not need these without 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();
Comments