0

I am having problems running my selenium grid in mac. I have downgraded my server standalone from 3.4 to 3.0.1. I get a System.InvalidOperationException using 3.4 so I downgraded till I get to 3.0.1 instead. I was able to open up the browser but the test won't continue. The exception that I generally get is:

 Only local connections are allowed.

08:56:27.458 WARN - Exception thrown

java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException

Build info: version: '3.2.0', revision: '8c03df6', time: '2017-03-02 09:34:51 -0800'

System info: host: 'D150006', ip: ‘ipaddress', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.5', java.version: '1.8.0_131'

Driver info: driver.version: unknown

at java.util.concurrent.FutureTask.report(FutureTask.java:122)

at java.util.concurrent.FutureTask.get(FutureTask.java:192)

at org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSession.java:183)

at org.openqa.selenium.remote.server.DefaultSession.<init>(DefaultSession.java:119)

at org.openqa.selenium.remote.server.DefaultSession.createSession(DefaultSession.java:95)

at org.openqa.selenium.remote.server.DefaultDriverSessions.newSession(DefaultDriverSessions.java:131)

at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:59)

at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:36)

at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:111)

at org.openqa.selenium.remote.server.JsonHttpCommandHandler.handleRequest(JsonHttpCommandHandler.java:189)

at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:222)

at org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.java:184)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)

at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:150)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)

at org.seleniumhq.jetty9.servlet.ServletHolder.handle(ServletHolder.java:841)

at org.seleniumhq.jetty9.servlet.ServletHandler.doHandle(ServletHandler.java:543)

at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)

at org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle(ContextHandler.java:1228)

at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)

at org.seleniumhq.jetty9.servlet.ServletHandler.doScope(ServletHandler.java:481)

at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)

at org.seleniumhq.jetty9.server.handler.ContextHandler.doScope(ContextHandler.java:1130)

at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:141)

at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)

at org.seleniumhq.jetty9.server.Server.handle(Server.java:564)

at org.seleniumhq.jetty9.server.HttpChannel.handle(HttpChannel.java:320)

at org.seleniumhq.jetty9.server.HttpConnection.onFillable(HttpConnection.java:251)

at org.seleniumhq.jetty9.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)

at org.seleniumhq.jetty9.io.FillInterest.fillable(FillInterest.java:112)

at org.seleniumhq.jetty9.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)

at org.seleniumhq.jetty9.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:672)

at org.seleniumhq.jetty9.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:590)

at java.lang.Thread.run(Thread.java:748)

Caused by: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException

Build info: version: '3.2.0', revision: '8c03df6', time: '2017-03-02 09:34:51 -0800'

System info: host: 'D150006', ip: ‘ipaddress', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.5', java.version: '1.8.0_131'

Driver info: driver.version: unknown

at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:113)

at org.openqa.selenium.remote.server.DefaultDriverProvider.newInstance(DefaultDriverProvider.java:97)

at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:60)

at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:222)

at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:209)

at java.util.concurrent.FutureTask.run(FutureTask.java:266)

at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

... 1 more

Caused by: java.lang.reflect.InvocationTargetException

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:423)

at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:103)

... 9 more

Caused by: org.openqa.selenium.WebDriverException: org.apache.http.conn.HttpHostConnectException: Connect to localhost:35534 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1, localhost/fe80:0:0:0:0:0:0:1%1] failed: Connection refused (Connection refused)

Build info: version: '3.2.0', revision: '8c03df6', time: '2017-03-02 09:34:51 -0800'

System info: host: 'D150006', ip: ‘ipaddress', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.5', java.version: '1.8.0_131'

Driver info: driver.version: ChromeDriver

at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:91)

at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:604)

at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:244)

at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)

at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:144)

at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:178)

at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:146)

... 14 more

Caused by: org.apache.http.conn.HttpHostConnectException: Connect to localhost:35534 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1, localhost/fe80:0:0:0:0:0:0:1%1] failed: Connection refused (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:160)

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)

... 20 more

Caused by: java.net.ConnectException: Connection refused (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)

... 35 more

08:56:27.460 WARN - Exception: Connection refused (Connection refused)

I am stuck in this issue and well, I also tried using the older versions and it won't help.

UPDATE: I am now able to run it on Safari 9 but having problems running it with Chrome in MAC OS. The error is:

Test Outcome:   Failed
Test Duration:  0:00:00

Result StackTrace:  
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
   at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
   at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
   at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(Uri remoteAddress, ICapabilities desiredCapabilities)
   at SeleniumE2E.Base.TestInitializer.OpenBrowser(BrowserType browserType, OSType osType, MachineType machineType) in C:\Users\Documents\Visual Studio 2015\Projects\SeleniumE2E\SeleniumE2E\Base\TestInitializer.cs:line 89
   at SeleniumE2E.Base.TestInitializer.InitializeSettings() in C:\Users\mivy\Documents\Visual Studio 2015\Projects\SeleniumE2E\SeleniumE2E\Base\TestInitializer.cs:line 28
   at SEL_ADAccountReactivate2.HookInitialize..ctor() in C:\Users\Documents\Visual Studio 2015\Projects\SEL_ADAccountReactivate2\SEL_ADAccountReactivate2\HookInitialize.cs:line 14
   at SEL_ADAccountReactivate2.SmokeTest..ctor()
Result Message: Unable to create instance of class SEL_ADAccountReactivate2.SmokeTest. Error: System.InvalidOperationException: Connection refused (Connection refused).

I have updated the google browser and used the older chromedriver so it would pull up the browser at least.. :(

2

Be sure that you have enabled automated test runs for Safari:

  1. Ensure that the Develop menu is available.
    1. It can be turned on by opening Safari preferences (Safari > Preferences in the menu bar), going to the Advanced tab, and ensuring that the Show Develop menu in menu bar checkbox is checked.
  2. Enable Remote Automation in the Develop menu. 1.This is toggled via Develop > Allow Remote Automation in the menu bar.
  3. Authorize safaridriver to launch the webdriverd service which hosts the local web server.
    1. To permit this, run /usr/bin/safaridriver once manually and complete the authentication prompt.

Here is the code I use to start a Grid Node (Note: I keep my .jar in Documents/Selenium):

#!/bin/bash
cd ~/Documents/Selenium/
java -jar selenium-server-standalone-3.3.1.jar -browser browserName=safari,platform=MAC -role node -hub http://localhost:4444/grid/register
  • I still am not able to run it :( I have an outdated mac, and safari as well. I use Safari 9 – Marj Jun 20 '17 at 18:24
  • Now i am able to run it, I had to downgrade to 2.53.0. Thanks @kirbycope – Marj Jun 20 '17 at 19:20
-1

I started my server using 2.53.0 of selenium grid, to run Safari 9.1.3. In order for me to run tests on chrome in MAC, I had to use 3.3.1 of selenium grid.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.