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


Java ChromeDriverManager类代码示例

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


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

示例1: getDriver

import io.github.bonigarcia.wdm.ChromeDriverManager; //导入依赖的package包/类
public static WebDriver getDriver() {

        String browser = System.getenv("BROWSER");
        if (browser == null) {
            ChromeDriverManager.getInstance().setup();
            return new ChromeDriver();
        }
        switch (browser)
        {
            case "IE":
                InternetExplorerDriverManager.getInstance().setup();
                return new InternetExplorerDriver();
            case "FIREFOX":
                FirefoxDriverManager.getInstance().setup();
                return new FirefoxDriver();
            default:
                ChromeDriverManager.getInstance().setup();
                return new ChromeDriver();

        }
    }
 
开发者ID:getgauge-examples,项目名称:java-maven-selenium,代码行数:22,代码来源:DriverFactory.java

示例2: setup

import io.github.bonigarcia.wdm.ChromeDriverManager; //导入依赖的package包/类
@BeforeAll
static void setup() throws Exception {
    // Start hub
    GridLauncherV3.main(new String[] { "-role", "hub", "-port", "4444" });

    // Register Chrome in hub
    ChromeDriverManager.getInstance().setup();
    GridLauncherV3.main(new String[] { "-role", "node", "-hub",
            "http://localhost:4444/grid/register", "-browser",
            "browserName=chrome", "-port", "5555" });

    // Register Firefox in hub
    FirefoxDriverManager.getInstance().setup();
    GridLauncherV3.main(new String[] { "-role", "node", "-hub",
            "http://localhost:4444/grid/register", "-browser",
            "browserName=firefox", "-port", "5556" });
}
 
开发者ID:bonigarcia,项目名称:selenium-jupiter,代码行数:18,代码来源:RemoteWebDriverJupiterTest.java

示例3: Setup

import io.github.bonigarcia.wdm.ChromeDriverManager; //导入依赖的package包/类
@BeforeSuite
public void Setup() {
    // Uses chrome driver by default
    String browser = System.getenv("BROWSER");
    if (browser == null) {
        browser = DEFAULT;
    }

    if (browser.toLowerCase().equals(FIREFOX)) {
        FirefoxDriverManager.getInstance().setup();
        driver = new FirefoxDriver();
    } else if (browser.toLowerCase().equals(IE)) {
        InternetExplorerDriverManager.getInstance().setup();
        driver = new InternetExplorerDriver();
    } else {
        ChromeDriverManager.getInstance().setup();
        driver = new ChromeDriver();
    }
}
 
开发者ID:getgauge-examples,项目名称:java-gradle-selenium,代码行数:20,代码来源:DriverFactory.java

示例4: testIgnoreVersions

import io.github.bonigarcia.wdm.ChromeDriverManager; //导入依赖的package包/类
@Test
public void testIgnoreVersions() {
    String[] ignoredVersions = { "2.33", "2.32" };
    ChromeDriverManager.getInstance().ignoreVersions(ignoredVersions)
            .setup();
    File binary = new File(
            ChromeDriverManager.getInstance().getBinaryPath());
    log.debug("Using binary {} (ignoring {})", binary,
            Arrays.toString(ignoredVersions));

    for (String version : ignoredVersions) {
        assertThat(binary.getName(), not(containsString(version)));
    }
}
 
开发者ID:bonigarcia,项目名称:webdrivermanager,代码行数:15,代码来源:IgnoredVersionTest.java

示例5: chrome

import io.github.bonigarcia.wdm.ChromeDriverManager; //导入依赖的package包/类
private WebDriver chrome(Settings settings, DesiredCapabilities customDesiredCapabilities) {
    ChromeDriverManager.getInstance().setup();
    DesiredCapabilities desiredCapabilities = getChromeDesiredCapabilities(settings);
    if (!customDesiredCapabilities.asMap().isEmpty()) {
        desiredCapabilities.merge(customDesiredCapabilities);
    }
    return new ChromeDriver(desiredCapabilities);
}
 
开发者ID:WileyLabs,项目名称:teasy,代码行数:9,代码来源:SeleniumTestExecutionListener.java

示例6: beforeTest

import io.github.bonigarcia.wdm.ChromeDriverManager; //导入依赖的package包/类
@Before
public void beforeTest() throws IOException {
    ChromeDriverManager.getInstance().setup();
    DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
    LoggingPreferences logPrefs = new LoggingPreferences();
    logPrefs.enable(LogType.BROWSER, Level.ALL);
    desiredCapabilities.setCapability(CapabilityType.LOGGING_PREFS, logPrefs);
    driver = new ChromeDriver(desiredCapabilities);
    accessibilitySniffer = new AccessibilitySniffer(driver);

}
 
开发者ID:SrinivasanTarget,项目名称:ja11y,代码行数:12,代码来源:AccessibilitySinfferTest.java

示例7: testForceOs

import io.github.bonigarcia.wdm.ChromeDriverManager; //导入依赖的package包/类
@Test
public void testForceOs() {
    ChromeDriverManager.getInstance().operativeSystem(operativeSystem)
            .setup();
    File binary = new File(
            ChromeDriverManager.getInstance().getBinaryPath());
    log.debug("OS {} - binary path {}", operativeSystem, binary);
    assertTrue(binary.exists());
}
 
开发者ID:bonigarcia,项目名称:webdrivermanager,代码行数:10,代码来源:ForceOsTest.java

示例8: testRealEnvProxyToNotNull

import io.github.bonigarcia.wdm.ChromeDriverManager; //导入依赖的package包/类
@Test
public void testRealEnvProxyToNotNull() throws Exception {
    WebDriverManager browserManager = ChromeDriverManager.getInstance();
    setSystemGetEnvMock(PROXY_URL);

    InetSocketAddress address = (InetSocketAddress) getProxy(browserManager)
            .get().address();
    assertThat(address.getHostName(), equalTo(PROXY_URL));
}
 
开发者ID:bonigarcia,项目名称:webdrivermanager,代码行数:10,代码来源:ProxyTest.java

示例9: testMockedEnvProxy

import io.github.bonigarcia.wdm.ChromeDriverManager; //导入依赖的package包/类
@Test
public void testMockedEnvProxy() throws Exception {
    for (String proxyTestString : PROXYS_TEST_STRINGS) {
        setSystemGetEnvMock(proxyTestString);

        log.info("Testing proxy {}", proxyTestString);

        WebDriverManager browserManager = ChromeDriverManager.getInstance();
        InetSocketAddress address = (InetSocketAddress) getProxy(
                browserManager).get().address();
        assertThat(address.getHostName(), equalTo(PROXY_URL));
    }
}
 
开发者ID:bonigarcia,项目名称:webdrivermanager,代码行数:14,代码来源:ProxyTest.java

示例10: testTaobao

import io.github.bonigarcia.wdm.ChromeDriverManager; //导入依赖的package包/类
@Test
public void testTaobao() throws Exception {
    setProperty("wdm.chromeDriverMirrorUrl",
            "http://npm.taobao.org/mirrors/chromedriver/2.33/");
    ChromeDriverManager.getInstance().useMirror().setup();

    File binary = new File(
            ChromeDriverManager.getInstance().getBinaryPath());
    assertTrue(binary.exists());
}
 
开发者ID:bonigarcia,项目名称:webdrivermanager,代码行数:11,代码来源:TaobaoTest.java

示例11: testMockProx

import io.github.bonigarcia.wdm.ChromeDriverManager; //导入依赖的package包/类
@Test
public void testMockProx() throws MalformedURLException {
    ChromeDriverManager.getInstance().proxy("localhost:" + proxyPort)
            .proxyUser("").proxyPass("")
            .driverRepositoryUrl(
                    new URL("https://chromedriver.storage.googleapis.com/"))
            .setup();
    File binary = new File(
            ChromeDriverManager.getInstance().getBinaryPath());
    assertTrue(binary.exists());
}
 
开发者ID:bonigarcia,项目名称:webdrivermanager,代码行数:12,代码来源:MockProxyTest.java

示例12: downloadDriver

import io.github.bonigarcia.wdm.ChromeDriverManager; //导入依赖的package包/类
public static void downloadDriver(DriverTypes driverType) {
    BrowserManager bm = null;
    try {
        switch (driverType) {
            case CHROME:
                bm = ChromeDriverManager.getInstance(); break;
            case FIREFOX:
                bm = FirefoxDriverManager.getInstance(); break;
            case IE:
                bm = InternetExplorerDriverManager.getInstance(); break;
        }
        if (bm == null)
            throw exception("Unknown driver: " + driverType);
        switch (platform) {
            case "32": bm = bm.arch32(); break;
            case "64": bm = bm.arch64(); break;
        }
        if (hasVersion())
            bm = bm.version(driverVersion);
        bm.setup();
    } catch (Exception ex) {
        throw exception("Can't download latest driver for " + driverType
                + ". Exception " + ex.getMessage());
    }
}
 
开发者ID:epam,项目名称:JDI,代码行数:26,代码来源:DownloadDriverManager.java

示例13: setupClass

import io.github.bonigarcia.wdm.ChromeDriverManager; //导入依赖的package包/类
@BeforeClass
public static void setupClass()
{
    String szDriverType = System.getProperty( DRIVER_SYS_PROP );
    if( StringUtils.isNotEmpty( szDriverType ) && szDriverType.equalsIgnoreCase( DriverType.CHROME.toString() ))
    {
        driverType = DriverType.CHROME;
        ChromeDriverManager.getInstance().setup();
    }
    else
    {
        driverType = DriverType.FIREFOX;
        MarionetteDriverManager.getInstance().setup();
    }
}
 
开发者ID:apache,项目名称:directory-fortress-commander,代码行数:16,代码来源:FortressWebSeleniumITCase.java

示例14: createChromeWebDriver

import io.github.bonigarcia.wdm.ChromeDriverManager; //导入依赖的package包/类
private static WebDriver createChromeWebDriver() {
  if (!mInitializedWebDrivers.contains(WebDriverType.CHROME)) {
    ChromeDriverManager.getInstance().setup();
    mInitializedWebDrivers.add(WebDriverType.CHROME);
  }

  final WebDriver selenium = new ChromeDriver();

  return selenium;
}
 
开发者ID:jpschewe,项目名称:fll-sw,代码行数:11,代码来源:IntegrationTestUtils.java

示例15: BasePage

import io.github.bonigarcia.wdm.ChromeDriverManager; //导入依赖的package包/类
BasePage() {
    ChromeDriverManager.getInstance().setup();
    Configuration.browser = "chrome";
}
 
开发者ID:endless-qa,项目名称:webdriver-examples-java,代码行数:5,代码来源:BasePage.java


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