我从你们那里得到了很多帮助,我真的很高兴。已经通过了这些混战,
web page source downloaded through Jsoup is not equal to the actual web page source
How to download a Web page source using Selenium
现在我终于在这里参加了最后一次聚会(希望如此)
在运行selenium测试用例时,像这样,
WebDriver driver = new FirefoxDriver();
FluentWebDriver fwd = new FluentWebDriver(driver);
driver.manage().timeouts().implicitlyWait(5L, TimeUnit.SECONDS);
driver.get("http://www.justdial.com/Bangalore/Tape-Dealers-%3Cnear%3E-Bangalore-City-Railway-Station/ct-12976/page-5");
String res = driver.getPageSource();它打开web浏览器并开始下载页面中的所有图像,并导致从我的java程序下载源代码的延迟。在这种情况下,如何避免打开浏览器??我只想要的页面源代码,没有图形内容。也因此避免了延迟。请帮帮我!!提前感谢!!
发布于 2013-11-16 21:10:18
我还没有用过FluentWebDriver,但我想你可以试着用HtmlUnitDriver代替FirefoxDriver:
替换:
WebDriver driver = new FirefoxDriver();
通过以下方式:
HtmlUnitDriver driver = new HtmlUnitDriver();
https://stackoverflow.com/questions/20018158
复制相似问题