Sunday, December 1, 2013

Running Siesta from a remote computer

How to run Siesta from a remote computer using Selenium Webdriver:


Suppose you have a machine which has linux file system and you write your test on it; But the test you execute need to run on a windows machine (for all browsers support, or from any other reason). 
Now you want to run a command in your linux machine, that will execute remotely all the desired tests on the windows machine and send back to the linux the alerts regarding which test passed and which tests failed.

On the "Server"

  1. On the “server” – where you want to run the browser (aka - the windows machine) copy the siesta files and folders (the latest version which you can get from here: http://www.bryntum.com/customerzone/home.php ) to c:\program files\
  2.  Install java (if not installed) from: http://www.oracle.com/technetwork/java/javase/downloads/index.html
  3. Access the siesta directory from cmd, and run the following commands:
        # cd c:\Program Files\siesta-2.0.4-standard\bin
        # webdriver-server -port 4444

On the "Client"

On the "client" - (in this example, it's the linux machine) navigate to Siesta's installation folder (the webapp directory) and cd to webapp/bin.

From the bin directory, execute the command:

# webdriver [the URL of your siesta GUI] --host ["server" - windows host name or IP address] --port 4444 --browser=[which browser to run on the windows client, i.e: firefox, chrome, ie, safari ]


Additional Flags

If you want to run just one test you can use the “--include” flag. If you want the output to be in JUnit format  you can use the “--report-format” and “--report-file” flags. 

For Example:

# webdriver http://IP/siestaTests --include=MytestFile.t.js --host YourHostName --port 4444 --browser=ie --report-format=JUnit --report-file=MytestFile_log_

For IE

This configuration works fine on firefox and chrome, but for IE there is some adjustments to make:
  1. Download the driver from here: https://code.google.com/p/selenium/downloads/list
  2. Copy to the windows machine (to C:\installations\selenium-2.37.0).
  3. Add this location in the PATH environment variables on your windows machine.
  4.  Set the protector mode: open the IE browser, choose "Internet Options..." from the Tools menu, and click on the Security tab. For each zone (4 zones usually), there will be a check box at the bottom of the tab labeled "Enable Protected Mode" – all of them should be the same, all checked or all unchecked.
  5. Set the browser to IE9 mode (press F12 and change the browser mode), and place it on top of all other windows. 

In order to make IE run in standard mode, add this line to the index.html file in webapp directory, right after the <head> tag:



Good luck!