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


Java FirefoxDriverManager类代码示例

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


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

示例1: getDriver

import io.github.bonigarcia.wdm.FirefoxDriverManager; //导入依赖的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.FirefoxDriverManager; //导入依赖的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: browserInit

import io.github.bonigarcia.wdm.FirefoxDriverManager; //导入依赖的package包/类
/**
 * Starts firefox through selenium to retrieve
 * cookie instance and process initialization.
 * 
 * @param driverSupplier Driver supplier to use.
 * @param contest Contest identifier to use.
 * @return <tt>true</tt> if the init command was correctly executed, <tt>false</tt> otherwise.
 */
private static CommandStatus browserInit(final Supplier<WebDriver> driverSupplier, final String contest) {
	out.println("[Initialization] Web browser will open, please authenticate to your Google account with it.");
	FirefoxDriverManager.getInstance().setup();
	final SeleniumCookieSupplier supplier = new SeleniumCookieSupplier(Request.getHostname() + "/codejam", FirefoxDriver::new);
	try {
		final String cookie = supplier.get();
		if (cookie == null) {
			err.println("-> Retrieved cookie instance is null, abort.");
		}
		else {
			return init(cookie, contest);
		}
	}
	catch (final IOException | UnreachableBrowserException | GeneralSecurityException e) {
		err.println("-> An error occurs while creating CodeJamSession");
		if (Application.isVerbose()) {
			e.printStackTrace();
		}
	}
	return CommandStatus.FAILED;
}
 
开发者ID:Faylixe,项目名称:googlecodejam-cli,代码行数:30,代码来源:ApplicationCommand.java

示例4: Setup

import io.github.bonigarcia.wdm.FirefoxDriverManager; //导入依赖的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

示例5: gecko

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

示例6: downloadDriver

import io.github.bonigarcia.wdm.FirefoxDriverManager; //导入依赖的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

示例7: createFirefoxWebDriver

import io.github.bonigarcia.wdm.FirefoxDriverManager; //导入依赖的package包/类
private static WebDriver createFirefoxWebDriver() {
  if (!mInitializedWebDrivers.contains(WebDriverType.FIREFOX)) {
    FirefoxDriverManager.getInstance().version("0.14.0").setup();
    mInitializedWebDrivers.add(WebDriverType.FIREFOX);
  }

  // final DesiredCapabilities capabilities = DesiredCapabilities.firefox();
  // capabilities.setCapability("marionette", true);
  // final WebDriver selenium = new FirefoxDriver(capabilities);

  final WebDriver selenium = new FirefoxDriver();
  return selenium;
}
 
开发者ID:jpschewe,项目名称:fll-sw,代码行数:14,代码来源:IntegrationTestUtils.java

示例8: createDriver

import io.github.bonigarcia.wdm.FirefoxDriverManager; //导入依赖的package包/类
@Override
public WebDriver createDriver(Capabilities capabilities) {
    String driverVersion = (String) capabilities.getCapability(CAPABILITY_DRIVER_VERSION);
    FirefoxDriverManager.getInstance().version(driverVersion).setup();
    return new FirefoxDriver((FirefoxOptions) capabilities);
}
 
开发者ID:isgarlo,项目名称:givemeadriver,代码行数:7,代码来源:FirefoxDriverFactory.java

示例9: beforeTest

import io.github.bonigarcia.wdm.FirefoxDriverManager; //导入依赖的package包/类
@BeforeClass(alwaysRun = true)
public void beforeTest() {
    FirefoxDriverManager.getInstance().setup();
}
 
开发者ID:bonigarcia,项目名称:webdrivermanager-examples,代码行数:5,代码来源:TestNgFirefoxTest.java

示例10: setupClass

import io.github.bonigarcia.wdm.FirefoxDriverManager; //导入依赖的package包/类
@BeforeClass
public static void setupClass() {
    ChromeDriverManager.getInstance().setup();
    FirefoxDriverManager.getInstance().setup();
}
 
开发者ID:bonigarcia,项目名称:webdrivermanager-examples,代码行数:6,代码来源:ChromeAndFirefoxTest.java

示例11: setupClass

import io.github.bonigarcia.wdm.FirefoxDriverManager; //导入依赖的package包/类
@BeforeClass
public static void setupClass() {
    FirefoxDriverManager.getInstance().setup();
}
 
开发者ID:bonigarcia,项目名称:webdrivermanager-examples,代码行数:5,代码来源:WebRtcFirefoxTest.java

示例12: setup

import io.github.bonigarcia.wdm.FirefoxDriverManager; //导入依赖的package包/类
@Before
public void setup() {
    browserManager = FirefoxDriverManager.getInstance();
    specificVersions = new String[] { "0.8.0", "0.19.1" };
}
 
开发者ID:bonigarcia,项目名称:webdrivermanager,代码行数:6,代码来源:FirefoxVersionTest.java


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