`
m635674608
  • 浏览: 4933704 次
  • 性别: Icon_minigender_1
  • 来自: 南京
社区版块
存档分类
最新评论

selenium phantomjs

    博客分类:
  • java
 
阅读更多
	public static WebDriver createWebDriver() {
		capability = DesiredCapabilities.phantomjs();
		capability.setJavascriptEnabled(false);
		FirefoxProfile profile = new FirefoxProfile();
		// 去掉css
		profile.setPreference("permissions.default.stylesheet", 2);
		// 去掉图片
		profile.setPreference("permissions.default.image", 2);
		// 去掉flash
		profile.setPreference("dom.ipc.plugins.enabled.libflashplayer.so",
				false);
		System.setProperty("phantomjs.binary.path",
				"E:\\test\\phantomjs-1.9.7-windows\\phantomjs.exe");
		// WebDriver ff = new HtmlUnitDriver(cc);
		WebDriver ff = new PhantomJSDriver(capability);
		// WebDriver ff= new Ph
		return ff;
	}

   <dependency>
    <groupId>com.github.detro.ghostdriver</groupId>
    <artifactId>phantomjsdriver</artifactId>
    <version>1.1.0</version>
</dependency>

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics