(Openshift) Connect Selenium Grid in Jenkins - selenium

Currently, our system is running in an Openshift cluster.
We have pods for Jenkins and Selenium.
Selenium service has 4444, 4443, and 4442 ports accessible.
The route of Selenium directly access port 4444. (http://cluster.domain)
In Jenkins, I've installed Selenium plugin. I would like to connect it to our existing Selenium pod, but it insists on having a port number. (like http://localhost:4444)
So now, when I put 4444 in port number in Jenkins, the URL looks like http://cluster.domain:4444 (which looks like http://ip.address:4444:4444)

Related

Jenkins selenium docker and application files

I have a docker hub and a docker node up and running.I have also a docker container which includes my application up and running with the same set up as my pc. I get the following error.
[ConnectionException] Can't connect to Webdriver at http://ip:4444/wd/hub. Please make sure that Selenium Server or PhantomJS is running.
The IP is correct since I see there the selenium grid as it should be. Which might be the problem. When I get inside the container that i have in jenkins it runs my tests also.
Have you explicitly instructed the Hub Docker Container to expose it's internal port 4444 as 4444 externally?
Instructing a container to expose ports does not enforce the same port numbers to be used. So in your case, while internally it is running on 4444, externally it could be whatever port Docker thought was the best choice when it started.
How did you start your container? If via the docker cmd line, then did you use -P or -p 4444:4444? (Note the difference in case). -P simply exposes ports but no guarantee of number, where as -p allows you to map as you wish.
There are many ways to orchestrate Docker which may allow you to control this in a different way.
For example, if you used Docker Compose that has the potential to allow your containers to communicate via 4444 even if those are not the actually exposed ports. It achieves this through some clever networking but is very simple to set up and use.

ERR_PROXY_CONNECTION_FAILED when using squid proxy for connection

I have a squid proxy container on my local Docker for Mac (datadog/squid image). Essentially I use this proxy so that app containers on my local docker and the browser pod (Selenium) on another host use the same network for testing (so that the remote browser can access the app host). But with my current setup, when I run my tests the browser starts up on the remote host and then after a bit fails the test. The message on the browser is ERR_PROXY_CONNECTION_FAILED right before it closes. So I assume that there is an issue with my squid proxy config. I use the default config and on the docker hub site it says
Please note that the stock configuration available with the container is set for local access, you may need to tweak it if your network scenario is different.
I'm not really sure how my network scenario is different. What should I be looking into for more information? Thanks!

Starting phantomjs node on Selenium grid on a external machine

I am trying to start a phantomjs node on a virtual machine to connect to my own computer which hosts the hub. I have gotten a generic node set up externally (5 instances of firefox, chrome and one instance of IE). When I try and set up a phantomjs node however, it registers fine from the command prompt, but when I go to the grid console, the following message is displayed:
DefaultRemoteProxy unknown version,Connect to failed: [myIp] Connection refused: connect
Does anyone have any experience with this?
Connection refused when phantomjs is run on different machine than selenium hub
Referenced this question... Basically had to add the IP of my node machine to the --webdriver param in the command line...

Cannot Connect Other Computers to Selenium Grid

I am able to register nodes to the hub when I'm working on just one computer, but when I try to connect a node that is running on another computer I get a timeout or a message saying the hub must be down or not responding. I have no idea how to solve this.
After starting the hub I get the message: Nodes should register to http:192.168...:4444/grid register.
A tutorial said that
"you can check if Machine B can access the hub's web interface by launching a browser there and going to where "iporhostnameofmachineA" should be the IP address or the hostname of the machine where the hub is running. Since Machine A's IP address is 192.168.1.3, then on the browser on Machine B you should type >http://192.168.1.3:4444/grid/console."
But chrome is giving me a "This site can't be reached error". This must be an issue with my network configuration, but I do not how what I should do to fix it.
I would try using the command 'telnet 192.168.1.3 4444' from your Selenium node and see if it connects. On the machine running the hub, (so 192.168.1.3) run 'netstat -antp | grep 4444' (assuming it's a linux machine) and make sure you see an entry showing that the port is being listened on. If it's a windows machine you can still use netstat but not grep I think. Once you confirm that the hub is indeed listening on port 4444, and you can ping 192.168.1.3, but cannot telnet to port 4444, you have basically determined that there is a firewall issue. Then you would need to look into the firewalls on both machines, and any firewalls between them.

Unit Testing Embedded Glassfish on Cloudbees

My REST application loads an embedded Glassfish before executing TestNG tests (actually make HTTP connection to REST resources). My questions are:
If I build the application on Cloudbees, will Jenkins for CI work?
Will Jenkins still run embedded Glassfish over port 8080, and execute tests using the HTTP protocol?
you should not rely hard-coded port 8080 but use a dynamically assigned port (you can use jenkins port allocator plugin). Maven also can provide such a random free port using build-helper plugin if you use it for building.