TCP connections created by Safari 10 web driver not closed when session creation failed
Originator: | mzhang444 | ||
Number: | rdar://28869733 | Date Originated: | 20-Oct-2016 |
Status: | Open | Resolved: | |
Product: | Safari | Product Version: | 10.0 |
Classification: | Reproducible: | Always |
Summary: When running selenium testing with selenium 3.01 and safari 10 using web driver from Safari 10, if session creation failed, for example "Allow Remote Automation" is not enabled, the TCP connections created by the web driver are not closed. Steps to Reproduce: 1. Set up selenium node using selenium-standalone 3.0.1 on OS X Sierra 10.12 2. With Safari 10 "Allow Remote Automation" unchecked, try to run an automated test from a remote Node.js server by using selenium javascript client binding 3.0.0.beta 3. After getting "WARN - Exception: Could not create a session: You must enable the 'Allow Remote Automation' option in Safari's Develop menu to control Safari via WebDriver. (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 0 milliseconds", enable "Allow Remote Automation" and restart Safari 10 4. Try running the same test again Expected Results: The Safari browser should be launched to execute the test. Actual Results: - Got an message on the Terminal console where the selenium node was started "Unable to start the server: another safaridriver is already running (@ localhost:27887).". This message is not showing up in the selenium node log. - The selenium log shows exception: Caused by: org.openqa.selenium.WebDriverException: The driver server has unexpectedly died! Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700' System info: host: 'I.local', ip: '192.168.1.176', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12', java.version: '1.8.0_60' Driver info: driver.version: SafariDriver at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:88) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:241) at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:128) at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:62) at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:53) ... 14 more Caused by: org.apache.http.conn.HttpHostConnectException: Connect to localhost:9169 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:158) at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353) at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380) at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184) at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55) at org.openqa.selenium.remote.internal.ApacheHttpClient.fallBackExecute(ApacheHttpClient.java:142) at org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:88) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:108) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:64) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141) at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82) ... 19 more Caused by: java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:74) at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:141) ... 34 more 10:39:56.262 WARN - Exception: Connection refused Version: OSX Sierre 10.12, Safari 10.0 Notes: - Issue "lsof -i tcp:27887" webdriver 13814 6u IPv4 0x988f27712c7b8857 0t0 TCP localhost:27887 (LISTEN) webdriver 13814 7u IPv6 0x988f27712e05fd07 0t0 TCP localhost:27887 (LISTEN) Kill the process creating the connection and run the test again, then the test will run and pass. Configuration: Attachments: 'selenium-node.log' was successfully uploaded.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
Hello I am facing the Same problem with the same error showing as above
Can you please help me in how to fix this and use it further
OS: MacOS Safari Selenium 3
Many Thanks Varun