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


Java Builder类代码示例

本文整理汇总了Java中org.openqa.selenium.chrome.ChromeDriverService.Builder的典型用法代码示例。如果您正苦于以下问题:Java Builder类的具体用法?Java Builder怎么用?Java Builder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Builder类属于org.openqa.selenium.chrome.ChromeDriverService包,在下文中一共展示了Builder类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createService

import org.openqa.selenium.chrome.ChromeDriverService.Builder; //导入依赖的package包/类
public ChromeDriverService createService(String... args) {
    Preconditions.checkArgument(args.length % 2 == 0, "arguments should be pairs");

    Map<String, String> environment = new HashMap<>();
    for (int i = 1; i < args.length; i += 2) {
        environment.put(args[i - 1], args[i]);
    }

    handleDISPLAYonLinux(environment);

    ChromeDriverService service = new Builder()
            .usingDriverExecutable(locationStrategy.findExecutable())
            .withVerbose(log.isDebugEnabled())
            .withEnvironment(environment)
            .usingAnyFreePort()
            .build();

    LoggingOutputStream loggingOutputStream = new LoggingOutputStream(log, LogLevel.INFO);
    service.sendOutputTo(loggingOutputStream);

    return service;
}
 
开发者ID:lkwg82,项目名称:de.lgohlke.selenium-webdriver,代码行数:23,代码来源:ChromeDriverServiceFactory.java

示例2: allocateChromeInstance

import org.openqa.selenium.chrome.ChromeDriverService.Builder; //导入依赖的package包/类
private static WebDriver allocateChromeInstance(BrowserModel model, Locale lang) throws IOException {
	DesiredCapabilities dc;
	switch(model) {
		default:
			throw new IllegalStateException("Unsupported browser type " + model.getCode() + " for local execution");

		case CHROME:
			dc = getChromeCapabilities(lang);
			break;

		case CHROME_HEADLESS:
			dc = getChromeHeadlessCapabilities(lang);
			break;
	}

	TestProperties tp = TUtilTestProperties.getTestProperties();
	String chromeBinariesLocation = tp.getProperty("webdriver.chrome.driver", "/usr/bin/google-chrome");
	System.setProperty("webdriver.chromedriver", chromeBinariesLocation);
	dc.setCapability("chrome.binary", chromeBinariesLocation);

	//-- Set the XDG_CONFIG_HOME envvar; this is used by fontconfig as one of its locations
	File dir = createFontConfigFile();
	Map<String, String> env = new HashMap<>();
	env.put("XDG_CONFIG_HOME", dir.getParentFile().getAbsolutePath());

	Builder builder = new Builder();
	builder.usingAnyFreePort();
	builder.withEnvironment(env);
	ChromeDriverService service = builder.build();
	MyChromeDriver chromeDriver = new MyChromeDriver(service, dc);

	chromeDriver.manage().window().setSize(new Dimension(1280, 1024));

	String browserName = chromeDriver.getCapabilities().getBrowserName();
	String version = chromeDriver.getCapabilities().getVersion();
	System.out.println("wd: allocated " + browserName + " " + version);

	return chromeDriver;
}
 
开发者ID:fjalvingh,项目名称:domui,代码行数:40,代码来源:WebDriverFactory.java

示例3: createDriverService

import org.openqa.selenium.chrome.ChromeDriverService.Builder; //导入依赖的package包/类
@Override
protected DriverService createDriverService() {
    Builder builder = new ChromeDriverService.Builder();
    if (port != null) builder.usingPort(port);
    if (driverExecutable != null) builder.usingDriverExecutable(driverExecutable);
    if (environment != null) builder.withEnvironment(environment);
    if (logFile != null) builder.withLogFile(logFile);
    if (verbose != null) builder.withVerbose(verbose);
    if (silent != null) builder.withSilent(silent);
    return builder.build();
}
 
开发者ID:viltgroup,项目名称:minium,代码行数:12,代码来源:ChromeDriverServiceProperties.java


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