Java Code Examples for org.openqa.selenium.htmlunit.HtmlUnitDriver#setJavascriptEnabled()
The following examples show how to use
org.openqa.selenium.htmlunit.HtmlUnitDriver#setJavascriptEnabled() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DemoSeleniumCrawler.java From WebCollector with GNU General Public License v3.0 | 6 votes |
public static void main(String[] args) throws Exception { Executor executor = new Executor() { @Override public void execute(CrawlDatum datum, CrawlDatums next) throws Exception { HtmlUnitDriver driver = new HtmlUnitDriver(); driver.setJavascriptEnabled(true); driver.get(datum.url()); List<WebElement> elementList = driver.findElementsByCssSelector("h3.vrTitle a"); for(WebElement element:elementList){ System.out.println("title:"+element.getText()); } } }; //创建一个基于伯克利DB的DBManager DBManager manager = new RocksDBManager("crawl"); //创建一个Crawler需要有DBManager和Executor Crawler crawler = new Crawler(manager, executor); crawler.addSeed("https://www.sogou.com/web?query=%E6%B7%98%E5%AE%9D"); crawler.start(1); }
Example 2
Source File: HiddenBrowserDriver.java From ats-framework with Apache License 2.0 | 5 votes |
@Override @PublicAtsApi public void start() { webDriver = new HtmlUnitDriver(this.browserVersion); webDriver.setJavascriptEnabled(true); setProxyIfAvailable(); fixHtmlUnitBehaviour(); log.info("Opening URL: " + url); webDriver.get(url); }
Example 3
Source File: SeleniumTestUtilities.java From Spring-Security-Third-Edition with MIT License | 5 votes |
public static WebDriver getHtmlUnitDriver() { HtmlUnitDriver driver = new HtmlUnitDriver(); driver.setJavascriptEnabled(true); return driver; }
Example 4
Source File: SeleniumTestUtilities.java From Spring-Security-Third-Edition with MIT License | 5 votes |
public static WebDriver getHtmlUnitDriver() { HtmlUnitDriver driver = new HtmlUnitDriver(); driver.setJavascriptEnabled(true); return driver; }
Example 5
Source File: SeleniumTestUtilities.java From Spring-Security-Third-Edition with MIT License | 5 votes |
public static WebDriver getHtmlUnitDriver() { HtmlUnitDriver driver = new HtmlUnitDriver(); driver.setJavascriptEnabled(true); return driver; }
Example 6
Source File: AcceptanceTestBase.java From mamute with Apache License 2.0 | 4 votes |
@SuppressWarnings("unused") private static WebDriver htmlUnitDriver() { HtmlUnitDriver driver = new HtmlUnitDriver(BrowserVersion.FIREFOX_24); driver.setJavascriptEnabled(true); return driver; }