Problem with using htmlunit driver for Selenium
I'm using the htmlunit driver wi开发者_如何学JAVAth selenium 2 but when the following call is made in my test:
driver.get(startPage);
It returns:
<?xml version="1.0" encoding="ISO-8859-1"?>
<html>
<head/>
<body/>
</html>
as the source page when I then call driver.getPageSource();
Does anyone have any idea why Selenium isn't downloading the full source for my page?
you have to use the code below:
ICapabilities desiredCapabilities = DesiredCapabilities.HtmlUnit();
IWebDriver driver = new RemoteWebDriver(desiredCapabilities);
driver.Navigate().GoToUrl("http://www.google.com/");
string a = driver.PageSource;
now the entire source code of the webpage is stored on the variable 'a'.
精彩评论