Tuesday, 15 November 2011

Runing ChromeDriver on Linux

I decided to use WebDriver in my project. It is a next version of Selenium library used for tests. I am using Ubuntu system. In my pom.xml I needed only to add one dependency:

<dependency>
  <groupId>org.seleniumhq.selenium</groupId>
  <artifactId>selenium-java</artifactId>
  <version>2.5.0</version>
</dependency>

I have created a simple java code in my main method:

 WebDriver driver = new ChromeDriver();
 driver.get("http://google.pl");
 driver.findElement(By.name("q")).sendKeys("Selenium");
 driver.findElement(By.name("q")).submit();

My program did not manage to connect to Chrome web browser. I needed to download chromedriver from http://code.google.com/p/chromium/downloads/list and add a system property webdriver.chrome.driver with path to this file.

It did work!

No comments: