Wednesday, September 5, 2012

Putting a head on Selenium: Display on a remote sccreen (windows)





     The advantages of having a headless system are ideal for any development cycle.  It speeds up testing times and allow the test to be run on the server.  These along with many other advantages are great but only IF you can get them to run.  One of the biggest problems and time consuming steps of using a headless system is trying to debug your test. Ideally, you run these test on you local machine and then you send them to a server repository where the will run.  As anyone who has even dabbled a little in the automation world knows things do not always give the same results on different systems and set-ups. Things can then get even more diffcult when the system is headless and you cant actually SEE the issue.

After much search i could not find any straight answer to how to exactly to export this display to my windows machine from our linux servers. Its really quite simiple and can be done in a few steps.

In order to display a headless selenium test on Windows Machine from a linux server you must first be able to have an X server running on you Windows machine. I used Xming as it is the easiest with almost no setup.

You need to download Xming from here:





When the installer finishes run the Xming server. Now you need to download Putty if you dont already have it you can get it here:


Download Putty.exe


http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html


Now that you have installed Putty run the executable.  In the left hand catagory listing for the settings click on the X11 tab and enable X11 forwarding!.







Type in you Host name or IP and connect.

Type firefox in the command line of you putty instance (ths assumes you have firefox on your system)

This should pop the firefoxbrowser!

Now that you can get the firefox profile to show on you machine you can run selenium and debug on the fly with the command:

 java -jar (PATH-TO)/selenium-server.jar -trustAllSSLCertificates -htmlSuite $BROWSER $URL  (PATH-TO)/$SUITE  (PATH-TO)/$LOG








No comments:

Post a Comment