当尝试在FirefoxDriver()上执行以下代码时,代码执行得非常好。
WebDriver driver = new FirefoxDriver();
但是当试图用HtmlUnitDriver()
执行相同的代码时WebDriver driver = new HtmlUnitDriver();
它会抛出错误
public void controller (String col1) throws Throwable{
WebDriver driver = new HtmlUnitDriver();
driver.get("http://sitename.com/signup");
driver.manage().timeouts().implicitlyWait(5,TimeUnit.SECONDS);
driver.manage().window().maximize();
driver.findElement(By.xpath("//*[@id='FN']")).sendKeys("test");
driver.findElement(By.xpath("//*[@id='LN']")).sendKeys("test");
获得以下错误
htmlTextInput[<input class="span10" type="text" name="FN" value="" id="FN" autocomplete="off">] -> HtmlHtml[<html>]
HtmlTextInput[<input class="span10" type="text" name="FN" value="" id="FN" autocomplete="off">] -> HtmlHtml[<html>]
HtmlTextInput[<input class="span10" type="text" name="FN" value="" id="FN" autocomplete="off">] -> HtmlHtml[<html>]
HtmlBody[<body>] -> HtmlHtml[<html>]