当前位置: 首页>>代码示例>>Java>>正文


Java DesiredCapabilities.phantomjs方法代码示例

本文整理汇总了Java中org.openqa.selenium.remote.DesiredCapabilities.phantomjs方法的典型用法代码示例。如果您正苦于以下问题:Java DesiredCapabilities.phantomjs方法的具体用法?Java DesiredCapabilities.phantomjs怎么用?Java DesiredCapabilities.phantomjs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openqa.selenium.remote.DesiredCapabilities的用法示例。


在下文中一共展示了DesiredCapabilities.phantomjs方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createPhantomJSDriver

import org.openqa.selenium.remote.DesiredCapabilities; //导入方法依赖的package包/类
private static WebDriver createPhantomJSDriver(String driverPath) {

		DesiredCapabilities desiredCapabilities = DesiredCapabilities.phantomjs();
		desiredCapabilities.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, driverPath);
		desiredCapabilities.setCapability(CapabilityType.ELEMENT_SCROLL_BEHAVIOR, true);
		desiredCapabilities.setCapability(CapabilityType.TAKES_SCREENSHOT, true);
		desiredCapabilities.setCapability(CapabilityType.ENABLE_PROFILING_CAPABILITY, true);
		desiredCapabilities.setCapability(CapabilityType.HAS_NATIVE_EVENTS, true);

		desiredCapabilities.setJavascriptEnabled(true);

		ArrayList<String> cliArgs = new ArrayList<String>();
		cliArgs.add("--web-security=true");
		cliArgs.add("--ignore-ssl-errors=true");
		desiredCapabilities.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, cliArgs);

		return new PhantomJSDriver(desiredCapabilities);
	}
 
开发者ID:entelgy-brasil,项目名称:zucchini,代码行数:19,代码来源:SeleniumDriver.java

示例2: createWebDriver

import org.openqa.selenium.remote.DesiredCapabilities; //导入方法依赖的package包/类
private WebDriver createWebDriver(final Consumer<DesiredCapabilities> desiredCapabilities) {

		String hostName = GhostDriverService.get().getHostName();

		DesiredCapabilities capabilities = DesiredCapabilities.phantomjs();
		if (desiredCapabilities != null) {
			desiredCapabilities.accept(capabilities);
		}
		try {
			WebDriver driver = new RemoteWebDriver(new URL("http://localhost:" + GhostDriverService.get().getLocalPort() + "/"), capabilities);
			driver.manage().window().setSize(new Dimension(1920, 1080));
			return driver;
		} catch (MalformedURLException e) {
			throw new IllegalStateException("Wrong hostName '" + hostName + "', possibly GhostDriverService::start not called ", e);
		}
	}
 
开发者ID:xtf-cz,项目名称:xtf,代码行数:17,代码来源:WebDriverService.java

示例3: PhantomJSFetcher

import org.openqa.selenium.remote.DesiredCapabilities; //导入方法依赖的package包/类
private PhantomJSFetcher(String phantomJsBinaryPath, int timeout, boolean loadImages, String userAgent, Collection<Cookie> cookies) {
    System.setProperty("phantomjs.binary.path", phantomJsBinaryPath);
    DesiredCapabilities capabilities = DesiredCapabilities.phantomjs();
    capabilities.setCapability("phantomjs.page.settings.resourceTimeout", timeout);
    capabilities.setCapability("phantomjs.page.settings.loadImages", loadImages);
    capabilities.setCapability("phantomjs.page.settings.userAgent", userAgent);
    this.webDriver = new PhantomJSDriver(capabilities);
    this.userAgent = userAgent;
    this.cookies = cookies;
}
 
开发者ID:ZhangJiupeng,项目名称:Gospy,代码行数:11,代码来源:PhantomJSFetcher.java

示例4: PhantomJSProcessor

import org.openqa.selenium.remote.DesiredCapabilities; //导入方法依赖的package包/类
private PhantomJSProcessor(String phantomJsBinaryPath, int timeout, boolean loadImages, String userAgent, Extractor<WebDriver, ?> handler, TaskFilter filter) {
    System.setProperty("phantomjs.binary.path", phantomJsBinaryPath);
    DesiredCapabilities capabilities = DesiredCapabilities.phantomjs();
    capabilities.setCapability("phantomjs.page.settings.resourceTimeout", timeout);
    capabilities.setCapability("phantomjs.page.settings.loadImages", loadImages);
    capabilities.setCapability("phantomjs.page.settings.userAgent", userAgent);
    this.webDriver = new PhantomJSDriver(capabilities);
    this.handler = handler;
    this.filter = filter;
}
 
开发者ID:ZhangJiupeng,项目名称:Gospy,代码行数:11,代码来源:PhantomJSProcessor.java

示例5: prepareDriver

import org.openqa.selenium.remote.DesiredCapabilities; //导入方法依赖的package包/类
/**
 * Create the driver instance
 */
@Override
protected void prepareDriver() throws Exception {
	if (!isLocalTest()) {
		capability = DesiredCapabilities.phantomjs();
	}
	super.prepareDriver();
}
 
开发者ID:ligoj,项目名称:bootstrap,代码行数:11,代码来源:TAbstractSeleniumITCase.java

示例6: SeleniumGridParallelITCase

import org.openqa.selenium.remote.DesiredCapabilities; //导入方法依赖的package包/类
public SeleniumGridParallelITCase() {
	// Add phantomjs in test
	super.repeatedCapabilities = new DesiredCapabilities[] { DesiredCapabilities.phantomjs(), DesiredCapabilities.phantomjs() };
}
 
开发者ID:ligoj,项目名称:bootstrap,代码行数:5,代码来源:SeleniumGridParallelITCase.java

示例7: SeleniumGridSequentialITCase

import org.openqa.selenium.remote.DesiredCapabilities; //导入方法依赖的package包/类
public SeleniumGridSequentialITCase() {
	// Add phantomjs in test
	super.repeatedCapabilities = new DesiredCapabilities[] { DesiredCapabilities.phantomjs(), DesiredCapabilities.phantomjs() };
}
 
开发者ID:ligoj,项目名称:bootstrap,代码行数:5,代码来源:SeleniumGridSequentialITCase.java

示例8: createPhantomJsDesiredCapabilities

import org.openqa.selenium.remote.DesiredCapabilities; //导入方法依赖的package包/类
public DesiredCapabilities createPhantomJsDesiredCapabilities(SiteConfig siteConfig, DriverConfig driverConfig) {
    DesiredCapabilities capabilities = DesiredCapabilities.phantomjs();

    capabilities.setJavascriptEnabled(true);

    return capabilities;
}
 
开发者ID:brucezee,项目名称:jspider,代码行数:8,代码来源:WebDriverFactory.java


注:本文中的org.openqa.selenium.remote.DesiredCapabilities.phantomjs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。