Timed out error on starting Webdriver server when connected to network via VPN - selenium-webdriver

In my protractor config file, I had this line, seleniumAddress: 'http://localhost:4444/wd/hub'. On running Protractor I was getting an error "ECONNREFUSED connect ECONNREFUSED". After going through lot of other existing issues and solutions, I removed "seleniumAddress" property. That resolved the issue. Selenium standalone server gets started. "Selenium standalone server started at http://192.168.1.156:64477/wd/hub"
But when I turn on the VPN, then I get an error "Error: Timed out waiting for the WebDriver server at http://192.168.1.156:63199/wd/hub", which I have been not able to resolve.
I am on a HP laptop which has Windows 7 Professional and I am using Cisco VPN.

(Hi, so I can't comment yet (low rep)...)
Could you try running webdriver-manager start before running protractor? It will run in the address http://localhost:4444/wd/hub which is the seleniumAddress referred to in the protractor config. Does that change anything?
This might be related (VPN-workaround): protractor stand alone selenium fails: Error: Timed out waiting for the WebDriver server at

Check the settings of the firewall that stays between Selenium standalone server (which might run also on your local host) and your working station (usually your localhost).
In my case (running on local Linux station) I had a very restrictive iptables firewall rules such that the WebDriver process launched on localhost could not access the Selenium standalone server which also run on localhost at whatever TCP port.
Just try to turn it off and check if that is the case ; then accommodate your firewall settings such that the respective connection passes your firewall rules.
If you want your scripts communicate directly with the Firefox|Chrome Driver (bypassing the Selenium server entirely) then try adding the directConnect: true in your protractor.conf.js
Git and other tools, often use the git: protocol for accessing files
in remote repositories. Some firewall configurations are blocking
git:// URLs, which leads to errors when trying to clone repositories
or download dependencies. (For example corporate firewalls are
"notorious" for blocking git:.)
If you run into this issue, you can force the use of https: instead,
by running the following command: git config --global
url."https://".insteadOf git://
(see Common Issues on Angular tutorial)

Related

How to run tests using selenium grid from Jenkins on different remote servers

We have Jenkins server hosted in Linux server, and we want to trigger our selenium tests from Jenkins to different remote desktops (Windows) using selenium grid (Here, Jenkins, hub, and node all three are in different machines).
Note: We aren't allowed to host Selenium hub in the same machine where we have Jenkins or install any Selenium Grid plugin in Jenkins.
You can use remote driver. Here is simple example
options = webdriver.ChromeOptions()
driver = webdriver.Remote(command_executor='http://<your_windows_IP_ADDR>:4444/wd/hub', options=options)
It will be in your code, you will run Selenium Server(Grid) on your Windows device. Then you can configure any setup after that.

FirefoxWebdriver on remote machines

Is it required to install the Firefox web driver on the remote machines acting as node or hub?
I tested the hub and nodes locally? I think, it is necessary to install the web driver on the hub and node. Any comments or suggestions?
Update:
Selenium jars are running (i.e. Java is installed and web driver also exists within the selenium jar as per the documentation). Why am I getting this error
Caused by: org.openqa.selenium.remote.ErrorHandler$UnknownServerException: Unable to connect to
host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
Also,
(process:13023): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
Error: no display specified
Thanks in advance!
You don't need anything on the machine that runs the hub except the selenium jar.
On the machine that runs the node you only need firefox itself to be installed, and the selenium jar running.
Firefox doesn't need a webdriver, only chrome.
from documentation
Firefox driver is included in the selenium-server-stanalone.jar
Yesterday, I was able to find the root cause, I was running these on the headless machines and needed those to be configured in order to launch ff. Thanks for your help!

End To End Testing on Headless Server

I am trying to set up an environment for end-to-end testing on a droplet running Ubuntu server 12.04.3 on digital ocean.
What I am trying to achieve in the end is for my jenkins (installed on the one droplet) to be able to run my end-to-end tests. Now, the server is ofcourse headless and the end-to-end tests need to run through a browser (I am using protractor with the selenium standalone server with chromedriver).
My question is: how do I spawn a browser on that machine? I have installed xorg and if I do startx on the server, log out and ssh -X to it, I can manually run the end-to-end tests (a browser pops up on my local machine). But I can get it to work without ssh -X to it, and since jenkins is on the same droplet where the tests are to be run. Well I dont get a browser to spawn.
NOTE: I know I might be missing something really trivial here since I don't fully understand the configuration nor the xorg.
Any hints or a complete answer is very much appreciated, this is giving me gray hair.
Edit: After a little digging I think i got the xorg stuff a bit wrong, i am guessing the purpose of X is to be able to spawn a window on a remote machine ( ie my local machine). And what i am after is more along the lines of a virtual frame buffer such as Xvfb...
There is PhantomJS but with Protractor is buggy and a dead-end.
You can still use Chrome & Firefox headless through docker-selenium or, if you don't like Docker you can do it yourself with ubuntu-headless sample. Both solutions provide Chrome & Firefox by using Xvfb even though there is no real DISPLAY.
UPDATE 2 Seems to be possible to run Xvfb in OSX: http://xquartz.macosforge.org/landing/
UPDATE 1 Mac OSX selenium headless solution:
Enable multi-user remote desktop access to OSX machine
So can test selenium headless on mac. Not headless really but as another user so it doesn't interfere with your current user display.
To do this you need kickstart: http://support.apple.com/en-us/HT201710
Begin using the kickstart utility
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -restart -agent
Activate Remote Desktop Sharing, enable access privileges for all users and restart ARD Agent:
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -restart -agent -privs -all
Apple Remote Desktop 3.2 or later only
Allow access for all users and give all users full access
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -allowAccessFor -allUsers -privs -all
Kickstart help command
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -help
A lot of angular apps use Travis CI to perform Protractor based end-to-end integration tests on headless vms all the time. I do not know the details of exactly how they do it but I do know that they use a linux service called xvfb which is a headless x windows implementation. Looking at a typical Travis configuration file, it appears that all they do before firing up their web server, selenium server and kicking off Protractor is to call sh -e /etc/init.d/xvfb start to start this service.

problems when installing kaazing websocket gateway

I use windows 7, apache 2.2.22 at port 80 and geoserver 2.1.3 at port 8080.
I download and run kaazing 3.5 msi x64 installer to install it locally on my laptop. I followed the official guidelines from the site. The msi succesfully installed the gateway.
But gets installed in C:\Applications Files\etc. not in C:\Program Filesx68\etc.
Anyhow, I tried to start the services, I ran the demo-services.start.bat and a notification came from windows saying that the Windows Fire Wall has blocked some of the features of java. So I hit "Allow" and wait. Command line says something like
"Sending data to ucd://localhost/50505, ucd://localhost/50506"
for over an hour, nothing happens. So I thought something went wrong with windows and java. I uninstall the kaazing, edit the Windows Fire Wall settings to allow java and re-install kaazing. The notification is not showing up now, but when I ran the demo-services.start.bat, still does nothing, just says the same thing. When I visit
http://localhost/8000
gives an 404 error.
I tried everything, chanching ports, uninstall and re-install a couple of times, installing while not connected to the internet, checking the windows fire wall settings, manually running demo-services.start.bat and gateway.start.bat . The gateway.start.bat actually runs ok and says that the gateway started, but still an 404 error when I visit localhost/8000. Installation through msi is always completed with no errors. But the Gateway does not work. Is it the fire wall, the demos bat file, I dont get it...
Tips/hints?
The first thing to do is get the Gateway running successfully first. So don't worry about running demo-services.start.bat yet.
From the Windows Services application, start Kaazing WebSocket Gateway. Then go to C:\Program Files\Kaazing, locate your installation and look in the log directory. Open error.log using a text editor and verify there are no errors.
If there are no errors, you should be able to open http://localhost:8001 from a browser. (Note, you had http://localhost/8000 in your example, but that last slash should be a colon.) You can use either port 8000 or 8001, but 8001 is where the samples are.
If you are using a firewall or something else that is intercepting ports, then you'll need to make sure ports 8000 and 8001 are accessible.
If you're not sure, start a different server process on port 8000 or 8001 (e.g. configure Apache to listen on port 8000 or 8001) and see if the browser can connect.
The msi succesfully installed the gateway. But gets installed in
C:\Applications Files\etc. not in C:\Program Filesx68\etc.
The Gateway is not an executable itself, but runs in a JVM. Therefore there is no 32bit code which constrains the application to be installed into C:\Program Files (x86). Thus C:\Program Files made the most sense.
You could use a 32-bit JVM which would reside in C:\Program Files (x86), but the Kaazing files are abstracted from that via Java, so C:\Program Files is a reasonable location for the Gateway.
BTW There is a forum on the Kaazing website for Kaazing questions.

Cannot access Jenkins

I have installed Jenkins on my Ubuntu 12.04 desktop machine using this guide:
https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Ubuntu
I also needed to follow this guide:
http://aslamnajeebdeen.com/blog/how-to-fix-apache-could-not-reliably-determine-the-servers-fully-qualified-domain-name-using-127011-for-servername-error-on-ubuntu
From my other machine (mac laptop) I now try to access Jenkins through safari:
http://192.168.1.100/jenkins
where 192.168.1.100 is the ip address of my desktop machine but I get an Error 404. I have also tried:
http://jenkins
but nothing happens. What am I missing?
The Jenkins service is running on my desktop PC:
service jenkins status
...
Jenkins Continuous Integration Server is running with the pid 3713
And if I enter: localhost:8080 in a browser on my desktop pc I get the jenkins web interface.
PROBLEM SOLVED:
I have followed this guide:
http://www.zzorn.net/2009/11/setting-up-hudson-on-port-80-on-debian.html
and it now works.
I had the same problem but not using Apache, rather only Jenkins on Ubuntu
I solved it by replacing HTTP_HOST=127.0.0.1 with HTTP_HOST=0.0.0.0 on /etc/default/jenkins
Jenkins is set to listen on port 8080 by default,
so you should point your browser to:
http://localhost:8080/
(or, in your case: http://192.168.1.100:8080/ )
EDIT:
If still not able to connect, you may wish to check your firewall settings.

Resources