Java 类org.openqa.selenium.firefox.FirefoxDriver 实例源码

项目:selenium-jupiter    文件:FirefoxAnnotationReaderTest.java   
@ParameterizedTest
@MethodSource("testClassProvider")
@SuppressWarnings("unchecked")
void testFirefoxOptions(Class<?> testClass) throws Exception {
    Parameter parameter = testClass
            .getMethod("webrtcTest", FirefoxDriver.class)
            .getParameters()[0];
    Optional<Object> testInstance = Optional.of(testClass.newInstance());

    FirefoxOptions firefoxOptions = (FirefoxOptions) annotationsReader
            .getOptions(parameter, testInstance);
    Map<String, Map<String, Boolean>> options = (Map<String, Map<String, Boolean>>) firefoxOptions
            .asMap().get(FIREFOX_OPTIONS);

    assertTrue(options.get("prefs")
            .get("media.navigator.permission.disabled"));
    assertTrue(options.get("prefs").get("media.navigator.streams.fake"));
}
项目:java-maven-selenium    文件:DriverFactory.java   
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();

        }
    }
项目:otinane    文件:LogoutTest.java   
@Test
public void startByWebDriver() {


    System.setProperty("webdriver.gecko.driver","C:\\geckodriver.exe");
    WebDriver driver = new FirefoxDriver();
    driver.navigate().to("http://localhost:8080/login");
    driver.findElement(By.name("username")).clear();
    driver.findElement(By.name("username")).sendKeys("TestAcc1");
    driver.findElement(By.name("password")).clear();
    driver.findElement(By.name("password")).sendKeys("12345678");
    driver.findElement(By.xpath("//button[@type='submit']")).click();
    driver.navigate().to("http://localhost:8080");
    driver.findElement(By.linkText("Logout")).click();

}
项目:selenium-cucumber-framework    文件:BrowserFactory.java   
public static WebDriver selectLocalBrowser() {
    switch (browser) {
    case Chrome:
        return new ChromeDriver();
    case Firefox:
        return new FirefoxDriver();
    case IE:
        return new InternetExplorerDriver();
    case Opera:
        return new OperaDriver();
    case Safari:
        return new SafariDriver();
    default:
        throw new WebDriverException("No browser specified");
    }
}
项目:selenium-jupiter    文件:SeleniumExtension.java   
public SeleniumExtension() {
    handlerMap.put(ChromeDriver.class, ChromeDriverHandler.class);
    handlerMap.put(FirefoxDriver.class, FirefoxDriverHandler.class);
    handlerMap.put(EdgeDriver.class, EdgeDriverHandler.class);
    handlerMap.put(OperaDriver.class, OperaDriverHandler.class);
    handlerMap.put(SafariDriver.class, SafariDriverHandler.class);
    handlerMap.put(RemoteWebDriver.class, RemoteDriverHandler.class);
    handlerMap.put(AppiumDriver.class, AppiumDriverHandler.class);
    handlerMap.put(List.class, ListDriverHandler.class);
    handlerMap.put(PhantomJSDriver.class, OtherDriverHandler.class);

    templateHandlerMap.put("chrome", ChromeDriver.class);
    templateHandlerMap.put("firefox", FirefoxDriver.class);
    templateHandlerMap.put("edge", EdgeDriver.class);
    templateHandlerMap.put("opera", OperaDriver.class);
    templateHandlerMap.put("safari", SafariDriver.class);
    templateHandlerMap.put("appium", AppiumDriver.class);
    templateHandlerMap.put("phantomjs", PhantomJSDriver.class);
    templateHandlerMap.put("chrome-in-docker", RemoteWebDriver.class);
    templateHandlerMap.put("firefox-in-docker", RemoteWebDriver.class);
    templateHandlerMap.put("opera-in-docker", RemoteWebDriver.class);
}
项目:selenium-jupiter    文件:FirefoxDriverHandler.java   
@Override
public void resolve() {
    try {
        Optional<Object> testInstance = context.getTestInstance();
        Optional<Capabilities> capabilities = annotationsReader
                .getCapabilities(parameter, testInstance);
        FirefoxOptions firefoxOptions = (FirefoxOptions) getOptions(
                parameter, testInstance);
        if (capabilities.isPresent()) {
            firefoxOptions.merge(capabilities.get());
        }
        object = new FirefoxDriver(firefoxOptions);
    } catch (Exception e) {
        handleException(e);
    }
}
项目:selenium-camp-17    文件:Java7WebDriverFactory.java   
public static WebDriver getDriverUsingSwitch() {
    final String browser = System.getProperty("browser");

    if (browser == null || browser.isEmpty()) {
        throw new IllegalStateException("'browser' property is missing!");
    }

    switch (browser) {
        case CHROME:
            return new ChromeDriver();
        case FIREFOX:
            return new FirefoxDriver();
        default:
            throw new IllegalArgumentException(browser + " browser is not supported!");
    }
}
项目:selenium-camp-17    文件:Java7WebDriverFactory.java   
public static WebDriver getDriverUsingIf(DesiredCapabilities desiredCapabilities) {
    if (desiredCapabilities == null) {
        throw new IllegalStateException("DesiredCapabilities are missing!");
    }

    final String browser = desiredCapabilities.getBrowserName();

    if (CHROME.equalsIgnoreCase(browser)) {
        return new ChromeDriver(desiredCapabilities);
    } else if (FIREFOX.equalsIgnoreCase(browser)) {
        return new FirefoxDriver(desiredCapabilities);
    } else if (browser.isEmpty()) {
        throw new IllegalStateException("'browser' capability is missing!");
    }

    throw new IllegalArgumentException(desiredCapabilities.getBrowserName() + " browser is not supported!");
}
项目:KeywordDrivenAutoTest    文件:Firefox.java   
/**
 * 本地初始化Firefox浏览器driver
 */
public Firefox() {
    DesiredCapabilities capabilities = DesiredCapabilities.firefox();
    capabilities.setCapability("acceptSslCerts", false);
    FirefoxBrowserProfile firefoxProfile = new FirefoxBrowserProfile();
    String sProfile = firefoxProfile.getDefaultProfile();
    if (sProfile.equals("")) {
        this.driver = new FirefoxDriver();
    } else {
        try {
            FirefoxProfile profile = new FirefoxProfile(new File(sProfile));
            FirefoxBinary firefoxBinary = new FirefoxBinary(new File(firefoxProfile.getFirefoxBinInstallPath()));
            profile.setAcceptUntrustedCertificates(false);
            this.driver = new FirefoxDriver(firefoxBinary, profile);
        } catch (Exception e) {
            throw new RuntimeException("Failed to start firefox browser,please check!", e);
        }
    }
}
项目:Voting_2b    文件:LoginSteps.java   
public LoginSteps() {

        Referendum ref = new Referendum();
        ref.setName("Ref");
        ref.setStartDate(new Date());
        Calendar c = Calendar.getInstance(); 
        c.setTime(new Date()); 
        c.add(Calendar.DATE, 1);
        ref.setExpiryDate(c.getTime());
        ref.setNumChoices(1);
        ref.setQuestion("Question");
        ref.setInstructions("Ins");

        Repository.electionR.save(ref);
        driver = new FirefoxDriver();
    }
项目:alimama    文件:SeleniumUtil.java   
public static WebDriver createWebDriver() throws Exception {
    DesiredCapabilities capability = DesiredCapabilities.chrome();
    capability.setJavascriptEnabled(true);
    FirefoxProfile firefoxProfile = new FirefoxProfile();
    // 鍘绘帀css
    // firefoxProfile.setPreference("permissions.default.stylesheet", 2);
    // 鍘绘帀鍥剧墖
    // firefoxProfile.setPreference("permissions.default.image", 2);
    // 鍘绘帀flash
    firefoxProfile.setPreference("dom.ipc.plugins.enabled.libflashplayer.so", false);

    capability.setCapability("firefox_profile", firefoxProfile);
    WebDriver driver = new FirefoxDriver(capability);

    // WebDriver driver = new HtmlUnitDriver();
    // WebDriver driver = new HtmlUnitDriver();
    // 濡傛灉3s鍐呰繕瀹氫綅涓嶅埌鍒欐姏鍑哄紓甯?
    // driver.manage().timeouts().implicitlyWait(IMPLICITLYWAIT,
    // TimeUnit.SECONDS);
    // 椤甸潰鍔犺浇瓒呮椂鏃堕棿璁剧疆涓?5s
    // driver.manage().timeouts().pageLoadTimeout(PAGELOADTIMEOUT,
    // TimeUnit.SECONDS);
    // driver.manage().timeouts().setScriptTimeout(60,TimeUnit.SECONDS);
    return driver;

}
项目:jwebrobot    文件:WebDriverProvider.java   
public WebDriver createInstance(Type type) {
    switch (type) {
        case CHROME:
            return new ChromeDriver();
        case CHROME_HEADLESS:
            ChromeOptions options = new ChromeOptions();
            options.addArguments("--headless", "--disable-gpu");
            ChromeDriver chromeDriver = new ChromeDriver(options);

            return chromeDriver;
        case OPERA:
            return new OperaDriver(getOperaCapabilities());
        case FIREFOX:
        default:
            return new FirefoxDriver();
    }
}
项目:googlecodejam-cli    文件:ApplicationCommand.java   
/**
 * Methods that is bound to the INIT command. 
 * 
 * @param command Command to retrieve method parameters from.
 * @return <tt>true</tt> if the init command was correctly executed, <tt>false</tt> otherwise.
 */
public static CommandStatus init(final CommandLine command) {
    final String contest = command.getOptionValue(CONTEST);
    if (command.hasOption(INIT_METHOD)) {
        final String method = command.getOptionValue(INIT_METHOD).toLowerCase();
        if (FIREFOX_METHOD.equals(method)) {
            return browserInit(FirefoxDriver::new, contest);
        }
        else if (TEXT_METHOD.equals(method)) {
            return textInit(contest);
        }
        err.println("-> Invalid method provided (only firefox or text supported");
        return CommandStatus.INVALID_FORMAT;
    }
    return browserInit(FirefoxDriver::new, contest);
}
项目:cashion    文件:TestBaseAssert.java   
@Test
public void f() {
 WebDriver driver = new FirefoxDriver();
 driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
 driver.get("http://test.zyd.onlyou.com/login.htm");
 driver.manage().window();
 driver.findElement(By.name("username")).click();
 driver.findElement(By.name("username")).sendKeys("pancs_qd");
 driver.findElement(By.name("password")).click();
 driver.findElement(By.name("password")).sendKeys("111111");
 driver.findElement(By.className("btn-submit")).click();
 WebDriverWait wait = new WebDriverWait(driver,10);//等待最长时间10s
 wait.until(new ExpectedCondition<WebElement>(){
  @Override
  public WebElement apply(WebDriver d){
      return d.findElement(By.id(""));
  }
 }).click();
 driver.close();

}
项目:selenium-example    文件:FirefoxTest.java   
@Before
public void prepare() {

    testUrl = "https://leftstick.github.io/";

    System.setProperty("webdriver.gecko.driver","webdriver/geckodriver");

    // Create a new instance of the Chrome driver
    // Notice that the remainder of the code relies on the interface,
    // not the implementation.
    driver = new FirefoxDriver();

    // And now use this to visit myBlog
    // Alternatively the same thing can be done like this
    // driver.navigate().to(testUrl);
    driver.get(testUrl);
}
项目:domui    文件:WebDriverFactory.java   
@NotNull private static WebDriver allocateFirefoxDriver(Locale lang) throws IOException {
    FirefoxOptions fo = new FirefoxOptions();

    ////-- Set the XDG_CONFIG_HOME envvar; this is used by fontconfig as one of its locations
    //File dir = createFontConfigFile();
    //FirefoxBinary ffb = new FirefoxBinary();
    //ffb.setEnvironmentProperty("XDG_CONFIG_HOME", dir.getParentFile().getAbsolutePath());
    //FirefoxOptions ffo = new FirefoxOptions(getFirefoxCapabilities(lang));
    //ffo.setBinary(ffb);
    //FirefoxDriver wd = new FirefoxDriver(ffo);

    replaceDotFonts();

    FirefoxDriver wd = new FirefoxDriver(getFirefoxCapabilities(lang));
    String browserName = wd.getCapabilities().getBrowserName();
    String version = wd.getCapabilities().getVersion();
    System.out.println("wd: allocated " + browserName + " " + version);
    return wd;
}
项目:teasy    文件:SeleniumTestExecutionListener.java   
private WebDriver firefox(final Settings settings, DesiredCapabilities customDesiredCapabilities) {
    DesiredCapabilities desiredCapabilities = getFireFoxDesiredCapabilities(settings);
    if (!customDesiredCapabilities.asMap().isEmpty()) {
        desiredCapabilities.merge(customDesiredCapabilities);
    }
    return new FirefoxDriver(desiredCapabilities);
}
项目:teasy    文件:SeleniumTestExecutionListener.java   
private WebDriver gecko(DesiredCapabilities customDesiredCapabilities) {
    FirefoxDriverManager.getInstance().setup();
    DesiredCapabilities desiredCapabilities = getGeckoDesiredCapabilities();
    if (!customDesiredCapabilities.asMap().isEmpty()) {
        desiredCapabilities.merge(customDesiredCapabilities);
    }
    return new FirefoxDriver(desiredCapabilities);
}
项目:teasy    文件:SeleniumTestExecutionListener.java   
private DesiredCapabilities getFireFoxDesiredCapabilities(Settings settings) {
    DesiredCapabilities capabilities = DesiredCapabilities.firefox();
    setAlertBehaviorCapabilities(capabilities);
    capabilities.setCapability(FirefoxDriver.MARIONETTE, false);
    capabilities.setCapability(FirefoxDriver.PROFILE, getFirefoxProfile(settings));
    capabilities.setPlatform(Platform.WINDOWS);
    capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
    setLoggingPrefs(capabilities);
    setProxy(capabilities);
    return capabilities;
}
项目:teasy    文件:SeleniumTestExecutionListener.java   
private DesiredCapabilities getGeckoDesiredCapabilities() {
    DesiredCapabilities capabilities = DesiredCapabilities.firefox();
    setAlertBehaviorCapabilities(capabilities);
    capabilities.setCapability(FirefoxDriver.MARIONETTE, true);
    capabilities.setPlatform(Platform.WINDOWS);
    capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);


    setLoggingPrefs(capabilities);
    setProxy(capabilities);
    return capabilities;
}
项目:teasy    文件:DriverUtils.java   
public static WebDriver getFFDriver() {
    Settings ffSettings = new Settings();
    BeanUtils.copyProperties(SELENIUM_SETTINGS, ffSettings);
    ffSettings.setDriverName("firefox");
    driverHolder.set(new FramesTransparentWebDriver(new FirefoxDriver(getFireFoxDesiredCapabilities(ffSettings))));
    return driverHolder.get();
}
项目:Learning-Spring-Boot-2.0-Second-Edition    文件:FirefoxDriverFactory.java   
@Override
public FirefoxDriver getObject() throws BeansException {
    if (properties.getFirefox().isEnabled()) {
        try {
            return new FirefoxDriver();
        } catch (WebDriverException e) {
            e.printStackTrace();
            // swallow the exception
        }
    }
    return null;
}
项目:Learning-Spring-Boot-2.0-Second-Edition    文件:WebDriverAutoConfigurationTests.java   
@Test
public void testWithMockedFirefox() {
    load(new Class[]{MockFirefoxConfiguration.class},
        "com.greglturnquist.webdriver.safari.enabled:false",
        "com.greglturnquist.webdriver.chrome.enabled:false");
    WebDriver driver = context.getBean(WebDriver.class);
    assertThat(ClassUtils.isAssignable(TakesScreenshot.class,
        driver.getClass())).isTrue();
    assertThat(ClassUtils.isAssignable(FirefoxDriver.class,
        driver.getClass())).isTrue();
}
项目:Learning-Spring-Boot-2.0-Second-Edition    文件:WebDriverAutoConfigurationTests.java   
@Bean
FirefoxDriverFactory firefoxDriverFactory() {
    FirefoxDriverFactory factory =
        mock(FirefoxDriverFactory.class);
    given(factory.getObject())
        .willReturn(mock(FirefoxDriver.class));
    return factory;
}
项目:mastering-junit5    文件:LocalWebDriverTest.java   
@Test
public void testWithFirefoxAndOpera(FirefoxDriver firefox,
        OperaDriver opera) {
    firefox.get("http://www.seleniumhq.org/");
    opera.get("http://junit.org/junit5/");

    assertTrue(firefox.getTitle().startsWith("Selenium"));
    assertTrue(opera.getTitle().equals("JUnit 5"));
}
项目:functional-programming-selenium-examples    文件:Firefox.java   
@Override
public WebDriver getWebDriver()
{
    System.setProperty("webdriver.gecko.driver", "src/test/resources/geckodriver.v0.11.1.mac");
    DesiredCapabilities capabilities=DesiredCapabilities.firefox();
    WebDriver driver = new FirefoxDriver(capabilities);
       return driver;
}
项目:java-maven-testng-starter    文件:AbstractTest.java   
@BeforeTest
@Parameters({"url"})
public void setup(String url) {
  // Set the path to the geckodriver
  System.setProperty("webdriver.gecko.driver", "./drivers/geckodriver");

  // Instantiate a new Page and navigate 
  // to the url specified in the testng.xml
  page = new Page(new FirefoxDriver());
  page.navigate(url);
}
项目:NoraUi    文件:DriverFactory.java   
/**
 * Generates a firefox webdriver.
 *
 * @return
 *         A firefox webdriver
 * @throws TechnicalException
 *             if an error occured when Webdriver setExecutable to true.
 */
private WebDriver generateFirefoxDriver() throws TechnicalException {
    final String pathWebdriver = DriverFactory.getPath(Driver.FIREFOX);
    if (!new File(pathWebdriver).setExecutable(true)) {
        throw new TechnicalException(Messages.getMessage(TechnicalException.TECHNICAL_ERROR_MESSAGE_WEBDRIVER_SET_EXECUTABLE));
    }
    logger.info("Generating Firefox driver ({}) ...", pathWebdriver);

    System.setProperty(Driver.FIREFOX.getDriverName(), pathWebdriver);

    final FirefoxOptions firefoxOptions = new FirefoxOptions();
    final FirefoxBinary firefoxBinary = new FirefoxBinary();

    final DesiredCapabilities capabilities = DesiredCapabilities.firefox();
    capabilities.setCapability(CapabilityType.ForSeleniumServer.ENSURING_CLEAN_SESSION, true);
    capabilities.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR, UnexpectedAlertBehaviour.ACCEPT);

    setLoggingLevel(capabilities);

    // Proxy configuration
    if (Context.getProxy().getProxyType() != ProxyType.UNSPECIFIED && Context.getProxy().getProxyType() != ProxyType.AUTODETECT) {
        capabilities.setCapability(CapabilityType.PROXY, Context.getProxy());
    }

    if (Context.isHeadless()) {
        firefoxBinary.addCommandLineOptions("--headless");
        firefoxOptions.setBinary(firefoxBinary);
    }
    firefoxOptions.setLogLevel(Level.OFF);

    capabilities.setCapability(FirefoxOptions.FIREFOX_OPTIONS, firefoxOptions);

    return new FirefoxDriver(capabilities);
}
项目:Java-Data-Science-Cookbook    文件:WebdataExtractionSelenium.java   
public static void main(String[] args) {
       WebDriver driver = new FirefoxDriver();
       driver.get("http://cogenglab.csd.uwo.ca/rushdi.htm");

       WebElement webElement = driver.findElement(By.xpath("//*[@id='content']"));
    System.out.println(webElement.getText());

}
项目:QA_Begin    文件:TestFindGoogle.java   
@Before
public  void setUpTest(){
    System.setProperty("webdriver.gecko.driver", "C:\\webdriver\\geckodriver-v0.11.1-win64\\geckodriver.exe");
    driver = new FirefoxDriver();
    driver.manage().window().maximize();
    driver.get("http://www.google.com");

}
项目:QA_Begin    文件:TestContactDoq.java   
@Before
public void setUpTest(){

    System.setProperty("webdriver.gecko.driver", "C:\\webdriver\\geckodriver-v0.11.1-win64\\geckodriver.exe");
    DesiredCapabilities dc = DesiredCapabilities.firefox();
    dc.setCapability("marionette", true);
    driver = new FirefoxDriver();
    driver.manage().window().maximize();
    driver.get("http://www.doqconsulting.com.br/#contact");
}
项目:testing_security_development_enterprise_systems    文件:SeleniumTestBase.java   
private static WebDriver getFirefoxDriver(){
    /*
        Need to have an updated Firefox, but also need
        to download and put the geckodriver in your own home dir.
        See:

        https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver
        https://github.com/mozilla/geckodriver/releases

        However, drivers for FireFox have been often unstable.
        Therefore, I do recommend to use Chrome instead
     */

    setupDriverExecutable("geckodriver", "webdriver.gecko.driver");

    DesiredCapabilities desiredCapabilities = DesiredCapabilities.firefox();
    desiredCapabilities.setCapability("marionette", true);
    desiredCapabilities.setJavascriptEnabled(true);

    return  new FirefoxDriver(desiredCapabilities);
}
项目:mpay24-java    文件:AbstractSeleniumTestcase.java   
protected RemoteWebDriver openFirefoxAtUrl(String url) {
        String geckoDriver = getGeckoDriver();
        if (geckoDriver != null)
            System.setProperty("webdriver.gecko.driver", geckoDriver);
        driver = new FirefoxDriver();
        driver.get(url);
        return driver;

//      driver = new ChromeDriver();
//      driver.get(url);
//      return driver;
    }
项目:selenium-jupiter    文件:FirefoxWithGlobalOptionsJupiterTest.java   
@Test
public void webrtcTest(FirefoxDriver driver) {
    driver.get(
            "https://webrtc.github.io/samples/src/content/devices/input-output/");
    assertThat(driver.findElement(By.id("video")).getTagName(),
            equalTo("video"));
}
项目:selenium-jupiter    文件:FirefoxWithOptionsJupiterTest.java   
@Test
public void webrtcTest(@Arguments("-private") @Preferences({
        "media.navigator.permission.disabled=true",
        "media.navigator.streams.fake=true" }) FirefoxDriver driver) {
    driver.get(
            "https://webrtc.github.io/samples/src/content/devices/input-output/");
    assertThat(driver.findElement(By.id("video")).getTagName(),
            equalTo("video"));
}
项目:selenium-jupiter    文件:SeleniumJupiterTest.java   
@Test
public void testWithChromeAndFirefox(ChromeDriver driver1,
        FirefoxDriver driver2) {
    driver1.get("http://www.seleniumhq.org/");
    driver2.get("http://junit.org/junit5/");
    assertThat(driver1.getTitle(), startsWith("Selenium"));
    assertThat(driver2.getTitle(), equalTo("JUnit 5"));
}
项目:selenium-jupiter    文件:FirefoxJupiterTest.java   
@Disabled("Redudant test for Travis CI suite")
// tag::snippet-in-doc[]
@Test
public void testWithTwoFirefoxs(FirefoxDriver driver1,
        FirefoxDriver driver2) {
    driver1.get("http://www.seleniumhq.org/");
    driver2.get("http://junit.org/junit5/");
    assertThat(driver1.getTitle(), startsWith("Selenium"));
    assertThat(driver2.getTitle(), equalTo("JUnit 5"));
}
项目:selenium-jupiter    文件:ForcedAnnotationReaderTest.java   
static Stream<Arguments> forcedTestProvider() {
    return Stream.of(
            Arguments.of(AppiumDriverHandler.class,
                    ForcedAppiumJupiterTest.class, AppiumDriver.class,
                    "appiumNoCapabilitiesTest"),
            Arguments.of(AppiumDriverHandler.class,
                    ForcedAppiumJupiterTest.class, AppiumDriver.class,
                    "appiumWithCapabilitiesTest"),
            Arguments.of(ChromeDriverHandler.class,
                    ForcedBadChromeJupiterTest.class, ChromeDriver.class,
                    "chromeTest"),
            Arguments.of(FirefoxDriverHandler.class,
                    ForcedBadFirefoxJupiterTest.class, FirefoxDriver.class,
                    "firefoxTest"),
            Arguments.of(RemoteDriverHandler.class,
                    ForcedBadRemoteJupiterTest.class, RemoteWebDriver.class,
                    "remoteTest"),
            Arguments.of(EdgeDriverHandler.class,
                    ForcedEdgeJupiterTest.class, EdgeDriver.class,
                    "edgeTest"),
            Arguments.of(OperaDriverHandler.class,
                    ForcedOperaJupiterTest.class, OperaDriver.class,
                    "operaTest"),
            Arguments.of(SafariDriverHandler.class,
                    ForcedSafariJupiterTest.class, SafariDriver.class,
                    "safariTest"));
}
项目:oldmonk    文件:WebCapabilitiesBuilder.java   
@Override
public WebCapabilitiesBuilder addBrowserProfile(BrowserProfile browserProfile) throws CapabilityNotPresentException
{
    String browser = capabilities.getBrowserName();

    if (browser.equalsIgnoreCase("firefox"))
    {
        if (browserProfile instanceof FirefoxBrowserProfile)
        {
            capabilities.setCapability(FirefoxDriver.PROFILE, browserProfile.createProfile());
        }

    } else if (browser.equalsIgnoreCase("ie"))
    {
        if (browserProfile instanceof IEBrowserProfile)
        {
            @SuppressWarnings("unchecked")
            Map<String, Boolean> ieCapabilities = (Map<String, Boolean>) browserProfile.createProfile();
            Iterator<Map.Entry<String, Boolean>> it = ieCapabilities.entrySet().iterator();

            while (it.hasNext())
            {
                Map.Entry<String, Boolean> keyValuePair = it.next();
                capabilities.setCapability(keyValuePair.getKey(), keyValuePair.getValue());
            }
        }
    } else if (browser.equalsIgnoreCase("chrome"))
    {
        if (browserProfile instanceof ChromeBrowserProfile)
        {
            capabilities.setCapability(ChromeOptions.CAPABILITY, browserProfile.createProfile());
        }
    } else
    {
        throw new CapabilityNotPresentException("Unable to create capability for adding browser profile!");
    }

    return this;
}
项目:Java-Testing-Toolbox    文件:FirefoxConfiguration.java   
/**
 * {@inheritDoc}
 */
@Override
public FirefoxDriver start(Capabilities other) {
    Capabilities capabilities = this.mergeCapabilities(other);

    if (capabilities == null) {
        return new FirefoxDriver();
    }

    return new FirefoxDriver(capabilities);
}