Archive for June, 2010


Running Selenium Webdriver remotely

Want to run your tests on a remote VM rather on your local machine using Webdriver.

Below code would be a start.

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;

URL url = new URL("http://127.0.0.1:4444/wd/hub"); //Could be your remote VM where you to run your tests

DesiredCapabilities capabilities;
capabilities = DesiredCapabilities.firefox();

//You can test multiple type of browser
//capabilities = DesiredCapabilities.internetExplorer(); 

driver = new RemoteWebDriver(url, capabilities);

//Open the web site
driver.get(“google.com”);  

//Type Search Term
(driver.findElement(By.name("q"))).sendKeys("Test Search Query"); 

//Click submit button
(driver.findElement(By.name("btnG"))).click();