Unable to make web socket connection in Selenium opened googleChrome browser - selenium

Below is the test page to check the web socket connection, I am opening below page in selenium with (*googlechrome), i am unable to connect to the web sockets.
http://websocket.org/echo.html
However in normal googlechrome browser we are able to connect to the web socket.
What is the difference? appreciate your quick help..
~Ashok

Have you try to connect the web socket with other browser? I had the similar problem before but I was using Firefox, it turned out that the proxy setting wasn't get pass on to the firefox profile which selenium use.

Related

WebSocket connection fails on Chrome without SSL

I'm setting up a WebSocket between a standard web page and a Tomcat v7.0.62 server. The connection works fine with Tomcat SSL turned on/off on Firefox, Edge and IE11. However, in Chrome (v66.03), the websocket only connects when I've turned on SSL on the server and connect via https. In Chrome, when I turn SSL off on the server and try to connect via http, it throws an error.
Here's the error Chrome throws when trying to connect via http with SSL turned off on Tomcat...
Error in connection establishment: net::ERR_PROXY_AUTH_REQUESTED_WITH_NO_CONNECTION
Here's my WebSocket connection code on the client...
var wss = "wss://";
if (document.location.protocol === "http:") {
wss = "ws://";
}
var wsURL = wss + document.location.host + "/status?sessionId=<%=session.getId()%>";
Is this something Chrome specific that needs special code on non-https websocket connections?
This is a Chrome specific behavior. Chrome doesn't allow unsecure websocket (ws) connections to localhost (only wss, so you should setup a TLS certificate for your local web/websocket server). But the same should work without any issues in Firefox and other browsers.
Please refer the Chrome bug report on Chromium regarding this issue. This particular problem is intentional, and they have made this change to make
Chrome more secure by preventing attacks against internal network devices and processes listening on localhost.
https://bugs.chromium.org/p/chromium/issues/detail?id=378566
Error in connection establishment: net::ERR_PROXY_AUTH_REQUESTED_WITH_NO_CONNECTION
It seems you might have a proxy with authentication in the middle, between the clients and the service. Depending on the proxy and clients configuration, it might let through SSL connections, but plain http will get filtered.
I can not confirm your issue. You can try the Echo Test here: http://www.websocket.org/echo.html
The website supports http and https, you can specify ws://echo.websocket.org and wss://echo.websocket.org. I have tried all combinations and they all worked for me.
My guess is that it is a configuration issue with your server or a problem with your browser extensions.

Running selenium grid hub with https protocol

I am running selenium grid in a secured private network. I want to receive request to hub in https protocol instead of http.
Simply,
Grid console: https://X.XX.XX.X:4444/grid/console
Grid : https://X.XX.XX.X:4444/wd/hub
I got to know about Ngnix server for receiving side and serve the request to hub and also reverse proxy for running hub in behind, but no idea how exactly to be done.
If anyone did in above or in other way. Please let me know.

ZAP Proxy Not Working

I am trying to Proxy my browser traffic through the ZAP Proxy tool. I have setup my browser proxy according to the user docs on ZAP site and the same as the instructions in the post below. My site I am trying to scan just hangs at the login page, but as soon as I disable the proxy everything works fine. Also, looking at the network traffic in the Firefox or Chrome Dev tools, it shows "Waiting for fonts.googleapis.com". Any ideas what I check or try? I have tried 4 different browsers
Adding authentication in ZAP tool to attack a URL
Turns out IIS and ZAP were both configured to use port 8080. I changed ZAP to use a different port and it worked fine.

Does Selenium Grid handsover the Node after connection?

As shown in this diag:
All the connections from the Selenium Tests(client) should go directly to Selenium HUB, then it will forward the request to an appropriate Node, and return the response.
But what i am observing, that after finding an appropriate Node, the client is trying to communicate directly to the Node.
But in case, the nodes are in a private network and are accesible only by the Selenium HUB and NOT ACCESSIBLE by the Selenium Tests(client) then the subsequent calls fails.
Any idea on how to force all the subsequent calls through the Selenium HUB only?
EDIT
The problem might be something different. My hub is running on 192.168.0.100(with another ip as 10.0.0.2).
So when i am connecting to 192.168.0.100 from my .Net RemoteWebDriverClient, after connecting to the appropriate node, it is using the another ip of the client(10.0.0.2) which is not accessible from my system.
The answer is NO, it doesn't. The Grid remain active throughout the connection.
The ip 10.0.0.2 was of the same selenium HUB machine only. The .net & java implementations of selenium RemoteWebDriver clients were switching to the location header parameter after the initial handshake. This is may be due to the .Net and Java HTTPClient implementations.

Selenium WebDriver is getting Connection refused - Connection refused (Errno::ECONNREFUSED)

I am using Selenium WebDriver with Capybara for Cucumber features for parallel testing. But I am getting
Connection refused - Connection refused (Errno::ECONNREFUSED)
Is this error related to Selenium WebDriver? Is it a known issue with the driver? Is it something else?
That message indicates that the target host was unreachable, or was not listening for new connections.
I'd recommend verifying that the target can in fact be reached over the network (using curl, ping, tracert, or whatever tool you prefer), since the source of your problem is very likely external to your test code itself.