Internet Explorer WebDriver hangs for an hour during CreateSession API Call - selenium

Internet Explorer Driver hangs for an hour during CreateSession Call. It hangs for an hour to find window handle for Internet Explorer Server and this issues happens intermittently. Has anyone experienced a similar issue ?
InternetExplorerDriver Version: 64-bit, 3.141.59
Microsoft Windows Server 2019: 64 bit
BrowserFactory::LaunchBrowserUsingIELaunchURL
D 2020-05-15 03:36:53:582 C:\Projects\webdriver\cpp\iedriver\BrowserFactory.cpp(250) Starting IE using the IELaunchURL API
D 2020-05-15 03:36:54:386 C:\Projects\webdriver\cpp\iedriver\BrowserFactory.cpp(204) IE launched successfully with process ID 4888
D 2020-05-15 03:36:54:386 C:\Projects\webdriver\cpp\iedriver\BrowserFactory.cpp(210) Process with ID 4888 is executing iexplore.exe
T 2020-05-15 03:36:54:386 C:\Projects\webdriver\cpp\iedriver\BrowserFactory.cpp(368) Entering BrowserFactory::AttachToBrowser
D 2020-05-15 03:36:54:386 C:\Projects\webdriver\cpp\iedriver\BrowserFactory.cpp(378) Using Active Accessibility to find IWebBrowser2 interface
T 2020-05-15 03:36:54:386 C:\Projects\webdriver\cpp\iedriver\BrowserFactory.cpp(427) Entering BrowserFactory::AttachToBrowserUsingActiveAccessibility
D 2020-05-15 04:36:59:140 C:\Projects\webdriver\cpp\iedriver\BrowserFactory.cpp(447) Found window handle 0000000000040298 for window with class 'Internet Explorer_Server' belonging to process with id 4888
T 2020-05-15 04:36:59:140 C:\Projects\webdriver\cpp\iedriver\BrowserFactory.cpp(332) Entering BrowserFactory::GetDocumentFromWindowHandle
D 2020-05-15 04:36:59:611 C:\Projects\webdriver\cpp\iedriver\BrowserFactory.cpp(399) Ignoring zoom setting: 0
T 2020-05-15 04:36:59:611 C:\Projects\webdriver\cpp\iedriver\BrowserFactory.cpp(591) Entering BrowserFactory::GetBrowserZoomLevel
T 2020-05-15 04:36:59:636 C:\Projects\webdriver\cpp\iedriver\BrowserFactory.cpp(631) Entering BrowserFactory::GetZoomLevel
D 2020-05-15 04:36:59:671 C:\Projects\webdriver\cpp\iedriver\BrowserFactory.cpp(711) Browser zoom level is 100%
I 2020-05-15 04:36:59:672 C:\Projects\webdriver\cpp\iedriver\IECommandExecutor.cpp(1366) Persistent hovering set to: 1
T 2020-05-15 04:36:59:672 C:\Projects\webdriver\cpp\iedriver\ProxyManager.cpp(103) ProxyManager::SetProxySettings
D 2020-05-15 04:36:59:672 C:\Projects\webdriver\cpp\iedriver\ProxyManager.cpp(119) Using existing system proxy settings.
T 2020-05-15 04:36:59:672 C:\Projects\webdriver\cpp\iedriver\DocumentHost.cpp(36) Entering DocumentHost::DocumentHost
T 2020-05-15 04:36:59:672 C:\Projects\webdriver\cpp\iedriver\CookieManager.cpp(48) Entering CookieManager::Initialize
T 2020-05-15 04:36:59:672 C:\Projects\webdriver\cpp\iedriver\Browser.cpp(38) Entering Browser::Browser
T 2020-05-15 04:36:59:672 C:\Projects\webdriver\cpp\iedriver\Browser.cpp(383) Entering Browser::AttachEvents

Related

Selenium Webdriver does not proceed with execution after URL is loaded. The response from server is never returned and execution stays in hung state

IEDriverServer 3.0.0 have also used multiple versions to see if it's a config issue.
Selenium WebDriver - 3.12.0
Once the request to open the URL is sent, the control is never returned back from server.
URL gets loaded but nothing happens after that as control is never returned and execution stays in hung state.
To be specific,
DesiredCapabilities caps = new DesiredCapabilities();
driver = new InternetExplorerDriver(caps);
This is the line where it hangs. This method of passing capability to driver has been deprecated but I have tried InternetExplorerOptions and InternetExplorerDriverService but both of which doesn't work.
Below is the last line of logs after that it stays like that.
Started InternetExplorerDriver server (32-bit)
3.1.0.0
Listening on port 30830
Only local connections are allowed
2020-01-31 11:52:04 INFO com.standardchartered.genie.downloader.Main wrapRun - DOWNLOADER START with args: "C:\Users\1596305\.genie\genie-uploader-4.jar" "https://artifactory.global.standardchartered.com/artifactory/maven-genie-release/com/standardchartered/genie/genie-uploader-4/4.1.14/genie-uploader-4-4.1.14.jar" "https://artifactory.global.standardchartered.com/artifactory/maven-genie-release/com/standardchartered/genie/genie-uploader-4/4.1.14/genie-uploader-4-4.1.14.jar.md5" "-Dbase.dir=C:\Users\1596305\.genie" "-Dinput.dir=C:\Users\1596305\.genie\input" "-Dserver.port=13579" "-Ddisplay.report=END"
2020-01-31 11:52:04 INFO com.standardchartered.genie.downloader.Main downloadAndStartUploader - Downloading uploader from URL https://artifactory.global.standardchartered.com/artifactory/maven-genie-release/com/standardchartered/genie/genie-uploader-4/4.1.14/genie-uploader-4-4.1.14.jar to file location C:\Users\1596305\.genie\genie-uploader-4.jar.
2020-01-31 11:52:04 INFO com.standardchartered.genie.downloader.replicator.Slf4jReplicatorListener onRejection - Will not download file. File checksum matches and file last update time is above cutoff time of 2020-01-31T05:22:04.755Z.
2020-01-31 11:52:04 INFO com.standardchartered.genie.downloader.Main downloadAndStartUploader - Port 13579 is already used. Not starting new uploader process.
2020-01-31 11:52:04 INFO com.standardchartered.genie.downloader.Main wrapRun - DOWNLOADER EXIT
and this is the exact line it fails:
Response response = execute(DriverCommand.NEW_SESSION, parameters);
It's in RemoteWebDriver class and response is never returned.

Running selenium script in IE throws error "Only local connections are allowed."

I've tried many things but still facing the same error. Can someone please help to suggest a solution?
Issue: When running selenium script in IE, I'm getting the following error.
Setting: I'm using IE 11 and selenium 2.53.0
Started InternetExplorerDriver server (64-bit)
2.53.1.0
Listening on port 10402
Only local connections are allowed
Things I have tried so far:
Changed IE Security setting such that all different zones are set to have Security Level = High
Unchecked 'Enable Protected Mode' for all zones
I tried both 32 bits and 64 bits of IEDriverServer.exe
I tried to add the following codes after setting system property for the driver
DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability("ignoreZoomSetting", true);
capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
capabilities.setCapability(InternetExplorerDriver.NATIVE_EVENTS, false);
capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
capabilities.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true);
Update
I updated selenium driver to 3.0.1 and changed IEDriver to 32 bits and getting following error
Started InternetExplorerDriver server (32-bit)
2.53.1.0
Listening on port 5420
Only local connections are allowed
Sep 26, 2017 12:03:15 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
Sep 26, 2017 12:03:23 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Falling back to original OSS JSON Wire Protocol.
Sep 26, 2017 12:03:30 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Falling back to straight W3C remote end connection
java.lang.RuntimeException
at org.testng.internal.TestResult.toString(TestResult.java:245)
at org.testng.internal.TestResult.toString(TestResult.java:226)
Resolution
For anyone who might be interested, I have resolved my issue based on the two posts below.
Basically
1) Need to modify registry setting
2) Extend browser capability to ignore zone setting and protected mode setting
IELaunchURL issue with Selenium IE Driver
In IE: org.openqa.selenium.WebDriverException: This usually means that a call to the COM method IWebBrowser2::Navigate2() failed

Selenium: Unable to run GhostDriver(phantomJS) node on Docker Selenium Grid Setup

I am trying to run my automation scripts using Selenium Grid setup and the docker images found at: https://github.com/SeleniumHQ/docker-selenium.
I am able to get the Docker Selenium Hub and ready to go. This is what it looks like on my Grid Console after starting the Hub and spawning 4 GhostDriver nodes:
Now running my tests after pointing them to the new hub time out when trying to hit any of my company's internal sites (eg. http://test.domain.com) but not if I point my tests to run against http://www.google.com for example. That being said it seems like the obvious reason is an issue with Docker using some DNS that it isn't supposed to, but that is not the case. I've verified the DNS the docker containers are pointed to by verifying the resolv.conf is pointing to a valid DNS entry (not 8.8.8.8 or something like that). Also I am able to ping and curl internal URLs fine, so it seems like the Docker containers should be able to hit the internal URLs.
Here is the log output from the Selenium Hub:
20:49:09.649 INFO - Selenium build info: version: '3.4.0', revision: 'unknown'
20:49:09.650 INFO - Launching Selenium Grid hub
2017-06-08 20:49:10.221:INFO::main: Logging initialized #949ms to org.seleniumhq.jetty9.util.log.StdErrLog
20:49:10.239 INFO - Will listen on 4444
2017-06-08 20:49:10.297:INFO:osjs.Server:main: jetty-9.4.3.v20170317
2017-06-08 20:49:10.336:INFO:osjs.session:main: DefaultSessionIdManager workerName=node0
2017-06-08 20:49:10.336:INFO:osjs.session:main: No SessionScavenger set, using defaults
2017-06-08 20:49:10.340:INFO:osjs.session:main: Scavenging every 600000ms
2017-06-08 20:49:10.348:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler#5d47c63f{/,null,AVAILABLE}
2017-06-08 20:49:10.369:INFO:osjs.AbstractConnector:main: Started ServerConnector#5ef60048{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
2017-06-08 20:49:10.370:INFO:osjs.Server:main: Started #1098ms
20:49:10.370 INFO - Nodes should register to http://12.12.0.2:4444/grid/register/
20:49:10.370 INFO - Selenium Grid hub is up and running
20:51:35.906 INFO - Registered a node http://12.12.0.3:4444
20:51:37.024 INFO - Registered a node http://12.12.0.4:4444
20:51:38.396 INFO - Registered a node http://12.12.0.5:4444
20:51:39.782 INFO - Registered a node http://12.12.0.6:4444
21:00:09.502 INFO - Got a request to create a new session: Capabilities [ phantomjs.ghostdriver.cli.args=--logLevel=NONE, commandTimeout=300, phantomjs.cli.args=[--web-security=false, --ssl-protocol=any, --ignore-ssl-errors=true], maxDuration=360}]
21:00:09.503 INFO - Trying to create a new session on test slot {seleniumProtocol=WebDriver, browserName=phantomjs, maxInstances=1}
21:00:13.037 INFO - Got a request to create a new session: Capabilities [ phantomjs.ghostdriver.cli.args=--logLevel=NONE, commandTimeout=300, phantomjs.cli.args=[--web-security=false, --ssl-protocol=any, --ignore-ssl-errors=true], maxDuration=360}]
21:00:13.038 INFO - Trying to create a new session on test slot {seleniumProtocol=WebDriver, browserName=phantomjs, maxInstances=1}
I've exhausted all my ideas at the moment as am wondering if anyone here might know what I am missing. Everything I can test looks like things should work fine but that's not the case.
Also, for what it is worth, I am able to successfully run this same Selenium Grid setup locally (minus Docker). It seems like the inclusion of Docker to the stack is what is breaking it (I'm new to Docker so let's be honest, I'm breaking it. :) )
Thanks,
The issue is perhaps due to proxy settings missing at your containers level. You would need to setup proxy for your docker container and then try again. You should be able to get things to work fine.
Please refer to this article to learn how to setup proxies for your docker containers.

In Robotframework how do I select a specific selenium grid node

I have selenium grid working with local and remote nodes from a test started in robotframework. I do not want to control selenium startup from within the robot test, I just want to say give me access to a selenium-node that is using a gateway which is the device under test(DUT). I want to in essence access specific nodes based on desired_criteria ~= mgmt in testbed1, client-interface in testbed1. Do I need a grid per testbed? It seems I need to associate a grid with a specific testbed and have another selenium running for the management interface.
Client ----------- DUT --------- Server
node | | mgmt interface
192.168/24 | |
| |
localhost ---- 10.0.1.1
hub + node + robot runner
I tried specifying platform=LINUX for client-node and platform=UNIX for local-node and thats not working in Open Browser. Now attempting use of robotframework_selenium2library, since I thought it was a drop in!
https://github.com/detro/ghostdriver/blob/master/README.md may provide a way to seperate instances, but it is still one instance running on a specific node, if I disable firefox on the client browsers and use that for manager access it will give me what I need - (hack! hack! hairball).
The key to solve this is to know which instance of selenium you are refering to when you call open_browser and that can be controlled by being explicit refering to the Selenium remote RC client_web.open_browser or by using Keyword Set Library Search Order.
*** Settings ***
Library SeleniumLibrary 120 ${CLIENT_IP} ${SELENIUM_SERVER_PORT} WITH NAME client_web
*** Variables ***
${MANAGER_BROWSER} Firefox
${BROWSER} Firefox
*** Test Cases ***
Verify Two Browsers Using Search Order
[Setup] Test Case Setup
[Tags] noncritical
Set Library Search Order SeleniumLibrary
${wb_index} = Open Browser ${DUT} ${MANAGER_BROWSER}
Set Library Search Order client_web
${wb_index} = Open Browser ${facebook} ${BROWSER}
Maximize Browser Window
Select Window main
Wait Until Page Contains ${page text} 10s
Log browser-index:${wb_index}
Comment Set suite variable Manager_Browser with call to open specific browser
[Teardown] Local Test Case Teardown

Selenium Grid + Jenkins Infrastructure execution

Pardon me for the lengthy description:
I have the following infrastructure where I am attempting to deploy the Selenium grid via Jenkins. For the sake of simplicity, I am using simplified IP addresses.
Machine 1 (Jenkins):
IP: 1.1.1.1
Machine 2 (The Test Script + The Firefox RC instance resides on this)
IP: 2.2.2.2
Machine 3 (The IE RC instance resides on this)
IP: 3.3.3.3
Now, I am starting instances of RC as follows:
Machine 2:
RC 1: ant -Dport=5555 -Denvironment=*firefox -Dhost=2.2.2.2 -DhubURL=http://1.1.1.1:4444 launch-remote-control
Machine 3:
RC 2: ant -Dport=5556 -Denvironment=*iexplore -Dhost=3.3.3.3 -DhubURL=http://1.1.1.1:4444 launch-remote-control
After doing this, I am able to establish connection on the Jenkins Selenium console for both Machine 2 and Machine 3.
As far as my test script (residing solely on Machine 2) is concerned -
For firefox,
selenium = new DefaultSelenium("1.1.1.1",4444,"*firefox","http://mytestURL.com")
For IE,
selenium = new DefaultSelenium("1.1.1.1",4444,"*iexplore","http://mytestURL.com")
The problem is that I unable to get the test script to execute on Machine 3, where the IE instance resides.
What settings do I have to make in the DefaultSelenium object to get the test script residing on Machine 2 to execute on Machine 3, via the Jenkins grid?
Thanks for looking.
The problem was with the host's IP address on Machine 3. This works as expected.