29
Oct

HtmlUnitDriver with RemoteWebDriver


import java.net.MalformedURLException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.Test;

public class ActualTest {

	@Test
	public void myFunction() throws MalformedURLException {
		WebDriver driver = new HtmlUnitDriver();
		driver.get("http://www.google.co.in");
		driver.quit();
	}

	@Test
	public void myFunction2() throws MalformedURLException {
		HtmlUnitDriver driver = new HtmlUnitDriver();
		DesiredCapabilities capabilities = DesiredCapabilities.htmlUnit();
		driver = new HtmlUnitDriver(capabilities);

		driver.get("http://www.google.co.in");
		System.out.println(driver.getTitle());
		driver.quit();
	}

}