I have launched selenoid on the my AWS server. I followed official tutorial: https://aerokube.com/cm/latest/
And started selenoid (+ui) in the following way:
cm selenoid start --vnc
cm selenoid-ui start --port 8081
Ports 4444 and 80 are opened in security group (both - in inbound and outbound rules)
Now I try to use selenoid remotely and setup webdriver:
ChromeOptions newOptions = new ChromeOptions();
newOptions.setCapability("enableVNC", true);
newOptions.setCapability("enableVideo", false);
newOptions.setCapability("sessionTimeout", "3m");
URL host;
try {
host = new URL(SELENOID_HUB);// -> http://x.xx.x.xx:4444/wd/hub
} catch (Exception e){
throw new RuntimeException();
}
RemoteWebDriver driver = new RemoteWebDriver(host, newOptions);
driver.setFileDetector(new LocalFileDetector());
return new ChromeDriver();
After code execution I receive error on the line RemoteWebDriver driver = new RemoteWebDriver(host, newOptions);
:
Caused by: java.net.ConnectException: Failed to connect to /x.xx.xx.x:80
Full stacktrace:
Caused by: org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host: 'DESKTOP-DT9E80O', ip: '192.168.0.113', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.6' Driver info: driver.version: RemoteWebDriver at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:573) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:131) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:144) at slotgentesting.configuration.DriverProvider.initChromeDriver(DriverProvider.java:68) at slotgentesting.configuration.DriverProvider.initDriver(DriverProvider.java:46) at slotgentesting.configuration.DriverProvider.getDriver(DriverProvider.java:84) at slotgentesting.actions.BaseAction.(BaseAction.java:9) at slotgentesting.actions.demo.DemoLoginPageAction.(DemoLoginPageAction.java:11) ... 50 more Caused by: java.net.ConnectException: Failed to connect to /x.x.x.xx:80 at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:247) at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:165) at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:257) at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:135) at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:114) at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200) at okhttp3.RealCall.execute(RealCall.java:77) at org.openqa.selenium.remote.internal.OkHttpClient.execute(OkHttpClient.java:103) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:105) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:74) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552) ... 58 more Caused by: java.net.ConnectException: Connection timed out: no further information at java.base/sun.nio.ch.Net.pollConnect(Native Method) at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:672) at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:549) at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:597) at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327) at java.base/java.net.Socket.connect(Socket.java:633) at okhttp3.internal.platform.Platform.connectSocket(Platform.java:129) at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:245) ... 80 more
- Additional info:
I have access to the http://x.xx.x.xx:4444/wd/hub from my browser and checked it in the PowerShell terminal:
Test-NetConnection -ComputerName x.x.x.x.x -Port 4444
result:
ComputerName : x.x.x.x RemoteAddress : x.x.x.x RemotePort : 4444 InterfaceAlias : Wi-Fi SourceAddress : 192.168.0.113 TcpTestSucceeded : True