Selenium_grid_logo_large Run the Demo on EC2
(Amazon Elastic Compute Cloud)

To run the demo against an EC2 instance of Selenium Grid you will need to complete the steps described Setting Up Selenium Grid on EC2.

Booting your first Selenium Grid on EC2

Go to the examples/ec2 directory within the Selenium Grid distribution and check that everything works as expected:

cap ec2:check_settings

Edit the Capfile to reflect the number of EC2 instances that you are willing to launch. The relevant line is

set :remote_control_farms_count, 5

Boot all your EC2 instances with:

cap grid:boot

Be patient, booting EC2 instances can take a while...

You can then view the current state of your Selenium Grid with

cap grid:info

Starting Selenium Grid Services

You can start Selenium Grid Hub, Remote Controls and VNC on the EC2 grid you just booted with:

cap grid:start

Visualizing what is happening

You can view the Selenium Grid Hub Console with:

cap hub:console

You can also VNC to all the Remote Controls with:

cap rc:view

You do not even need the password if you use the "cap rc:view" command: This task will detect vncviewer or chicken of VNC on your machine and gives the vnc password file directly to the VNC client so that you are not even prompted for any password. Quite handy to open a VNC window for all of your RCs in one command ;-)

In case you need it the super secret password is "seleniumgrid" (no double quotes). It is stored on EC2 instance in an encrypted form under ~/.vnc/password.

If you cannot connect, it might be that the VNC servers were not started. You can start them with

cap rc:vnc:start

Running The demo against the your EC2 Grid

To run Selenium tests against the EC2 grid you need to know the DNS name of the Selenium Grid Hub. You can discover it by running:

cap grid:info

From know let's assume the Hub DNS name is ec2-67-202-25-36.compute-1.amazonaws.com

You can then navigate back to the root of Selenium Grid distribution:

cd ../..

... and run the demo with:

 ant -DseleniumHost=ec2-67-202-25-36.compute-1.amazonaws.com  run-demo-in-parallel

You can then visualize browsers running the tests in your VNC windows.

Shutting Down the Grid

Once you are done experimenting with Selenium Grid on EC2 you can shutdown all the EC2 instances (and stop be charged for it) with:

cap grid:shutdown

You can double-check that everything has been stopped properly:

ec2-describe-instances | grep running

What's next?

Stay tuned for more documentation on Selenium Grid integration with EC2. In the meantime you can explore other feature by running in the examples/ec2 directory:

$ cap -T
cap ec2:check_settings # Check EC2 related configuration.
cap grid:boot # Boot EC2 Instances for a Selenium Grid of 1 Hub and ...
cap grid:info # Display infoemation about current Selenium Grid
cap grid:shutdown # Shutdown EC2 Instance used to run Selenium Hub.
cap grid:start # Start Selenium Grid Hub.
cap grid:stop # Stop Selenium Grid Hub.
cap hub:boot # Boot a new EC2 Instance to Run Selenium Grid Hub.
cap hub:console # Open Selenium Grid Hub Console in a browser.
cap hub:logs # View Selenium Grid Hub logs.
cap hub:restart # (Re)start Selenium Grid Hub.
cap hub:shutdown # Shutdown EC2 Instance used to run Selenium Hub.
cap hub:start # Start Selenium Grid Hub.
cap hub:stop # Stop Selenium Grid Hub.
cap invoke # Invoke a single command on the remote servers.
cap rc:boot # Boot a new EC2 Instance to run a collection of Selen...
cap rc:restart # (Re)start Remote Controls for all farms.
cap rc:shutdown # Shutdown all EC2 Instances used to run Selenium Grid...
cap rc:start # Start Remote Controls for all farms.
cap rc:stop # Stop Remote Controls for all farms.
cap rc:view # Visualize what is happening in Remote Control Farms ...
cap rc:vnc:start # Start VNC server on all Remote Control Farms