开发者

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'.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜