本文整理汇总了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);
}
示例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);
}
}
示例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;
}
示例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;
}
示例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();
}
示例6: SeleniumGridParallelITCase
import org.openqa.selenium.remote.DesiredCapabilities; //导入方法依赖的package包/类
public SeleniumGridParallelITCase() {
// Add phantomjs in test
super.repeatedCapabilities = new DesiredCapabilities[] { DesiredCapabilities.phantomjs(), DesiredCapabilities.phantomjs() };
}
示例7: SeleniumGridSequentialITCase
import org.openqa.selenium.remote.DesiredCapabilities; //导入方法依赖的package包/类
public SeleniumGridSequentialITCase() {
// Add phantomjs in test
super.repeatedCapabilities = new DesiredCapabilities[] { DesiredCapabilities.phantomjs(), DesiredCapabilities.phantomjs() };
}
示例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;
}