O'Reilly logo

Selenium 2 Testing Tools Beginner's Guide by David Burns

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – writing tests against the grid

Now that we have a Selenium Grid set up we need to write a test that works against the grid. Working against Selenium grid is exactly the same as working with Selenium WebDrive's RemoteWebDriver. The Selenium Grid will find the relevant node and route all the commands to be executed there.

  1. Create a new test file.
  2. Populate it with a test script that accesses an item on the grid and then works against http://book.theautomatedtester.co.uk/. Your script should look something like the following:
    import org.junit.*; import org.openqa.selenium.*; import org.openqa.selenium.firefox.*; import java.io.File; import java.util.Dictionary; public class TestExample1 { WebDriver driver; @Before public void setUp(){ ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required