2012/12/06

Browser test with Selenium and WebDriver

I recently try to make browser tests with Selenium and WebDriver. I found it is very useful and fan. I use to use Selenium-RC and PHP bindings and Ruby bindings. In my project, I use Selenium2, WebDriver and Java bindings.
It is easy to install with maven(pom.xml).

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.10</version>
      <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>2.25.0</version>
    </dependency>
  </dependencies>
And I downloaded Selenium Server at Selenium site.
If you want to use Chrome for your test, Chromedriver is also needed. It could download from this site. Running Selenium Server with Cromedriver is a following command options:

java -jar selenium-server-standalone-2.25.0.jar -Dwebdriver.chrome.driver=C:\path\to\chromedriver.exe

Selenium server is now ready for accept the command from test cases. If you have enough network allowances, The server can accept from even other hosts so that you can make CI server and distributed testing clients.

No comments:

Post a Comment