當前位置: 首頁>>代碼示例>>Java>>正文


Java DesiredCapabilities.firefox方法代碼示例

本文整理匯總了Java中org.openqa.selenium.remote.DesiredCapabilities.firefox方法的典型用法代碼示例。如果您正苦於以下問題:Java DesiredCapabilities.firefox方法的具體用法?Java DesiredCapabilities.firefox怎麽用?Java DesiredCapabilities.firefox使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.openqa.selenium.remote.DesiredCapabilities的用法示例。


在下文中一共展示了DesiredCapabilities.firefox方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getFirefoxDriver

import org.openqa.selenium.remote.DesiredCapabilities; //導入方法依賴的package包/類
public static WebDriver getFirefoxDriver()
            throws Exception
	{
        baseDir = new File(".").getPath();
        System.out.println("******** " + baseDir);

        String path = "src/test/resources/geckodriver";
        System.out.println("******** " + path);
		System.setProperty("webdriver.gecko.driver", path);

        DesiredCapabilities capabilities =  DesiredCapabilities.firefox();
		capabilities.setCapability("marionette", true);
        capabilities.setCapability("networkConnectionEnabled", true);
        capabilities.setCapability("browserConnectionEnabled", true);


        WebDriver driver = new RemoteWebDriver(
                new URL("http://localhost:4444"),
                capabilities);

//		WebDriver driver = new MarionetteDriver(capabilities);

		return driver;
	}
 
開發者ID:PacktPublishing,項目名稱:Spring-Security-Third-Edition,代碼行數:25,代碼來源:SeleniumTestUtilities.java

示例2: setUpTest

import org.openqa.selenium.remote.DesiredCapabilities; //導入方法依賴的package包/類
@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");
}
 
開發者ID:vitorc,項目名稱:QA_Begin,代碼行數:11,代碼來源:TestContactDoq.java

示例3: getFirefoxDriver

import org.openqa.selenium.remote.DesiredCapabilities; //導入方法依賴的package包/類
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);
}
 
開發者ID:arcuri82,項目名稱:testing_security_development_enterprise_systems,代碼行數:22,代碼來源:SeleniumTestBase.java

示例4: firefox

import org.openqa.selenium.remote.DesiredCapabilities; //導入方法依賴的package包/類
/**
 * 火狐瀏覽器配置
 */
private void firefox()
{
	DesiredCapabilities capability = DesiredCapabilities.firefox();
	capability.setCapability("marionette", true);
	engineCapMap.put(DRIVER_FIREFOX, capability);
}
 
開發者ID:LinuxSuRen,項目名稱:phoenix.webui.framework,代碼行數:10,代碼來源:CapabilityConfig.java

示例5: getWebDriver

import org.openqa.selenium.remote.DesiredCapabilities; //導入方法依賴的package包/類
@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;
}
 
開發者ID:5hawnknight,項目名稱:functional-programming-selenium-examples,代碼行數:9,代碼來源:Firefox.java

示例6: generateFirefoxDriver

import org.openqa.selenium.remote.DesiredCapabilities; //導入方法依賴的package包/類
/**
 * 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);
}
 
開發者ID:NoraUi,項目名稱:NoraUi,代碼行數:42,代碼來源:DriverFactory.java

示例7: createFireFoxDriver

import org.openqa.selenium.remote.DesiredCapabilities; //導入方法依賴的package包/類
private static WebDriver createFireFoxDriver() {
	FirefoxProfile firefoxProfile = new FirefoxProfile();
	firefoxProfile.setEnableNativeEvents(false);
	firefoxProfile.setAcceptUntrustedCertificates(true);
	firefoxProfile.setPreference("layers.acceleration.disabled", true);

	DesiredCapabilities desiredCapabilities = DesiredCapabilities.firefox();
	desiredCapabilities.setCapability(FirefoxDriver.PROFILE, firefoxProfile);

	return new FirefoxDriver(desiredCapabilities);
}
 
開發者ID:entelgy-brasil,項目名稱:zucchini,代碼行數:12,代碼來源:SeleniumDriver.java

示例8: getFireFoxDesiredCapabilities

import org.openqa.selenium.remote.DesiredCapabilities; //導入方法依賴的package包/類
private static DesiredCapabilities getFireFoxDesiredCapabilities(Settings settings) {
    DesiredCapabilities capabilities = DesiredCapabilities.firefox();
    capabilities.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR, UnexpectedAlertBehaviour.ACCEPT);
    capabilities.setCapability(FirefoxDriver.PROFILE, getFirefoxProfile(settings));
    return capabilities;
}
 
開發者ID:WileyLabs,項目名稱:teasy,代碼行數:7,代碼來源:DriverUtils.java

示例9: capabilitiesFirefox

import org.openqa.selenium.remote.DesiredCapabilities; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
private static DesiredCapabilities capabilitiesFirefox() {

	final String geckoDriverPath = (applicationGeckoDriverPath == null)
			? osName.toLowerCase().startsWith("windows")
					? "c:/java/selenium/geckodriver.exe" : "/var/run/geckodriver"
			: applicationGeckoDriverPath;
	// firefox.browser.path
	final String firefoxBrowserPath = (applicationFirefoxBrowserPath == null)
			? osName.toLowerCase().startsWith("windows")
					? "c:/Program Files (x86)/Mozilla Firefox/firefox.exe"
					: osName.toLowerCase().startsWith("mac")
							? "/Applications/Firefox.app/Contents/MacOS/firefox.bin"
							: "/usr/bin/firefox/firefox"
			: applicationFirefoxBrowserPath;
	System.setProperty("webdriver.gecko.driver",
			new File(geckoDriverPath).getAbsolutePath());
	System.setProperty("webdriver.firefox.bin",
			new File(firefoxBrowserPath).getAbsolutePath());
	System.setProperty("webdriver.reap_profile", "false");
	DesiredCapabilities capabilities = DesiredCapabilities.firefox();

	// TODO: switch to Selenium 3.X+
	/*
	FirefoxOptions firefoxOptions = new FirefoxOptions();
	firefoxOptions.setBinary(new File(firefoxBrowserPath).getAbsolutePath());
	
	capabilities.setCapability("moz:firefoxOptions", firefoxOptions);
	*/
	capabilities.setCapability("firefox_binary",
			new File(firefoxBrowserPath).getAbsolutePath());

	capabilities.setCapability("marionette", false);
	FirefoxProfile profile = new FirefoxProfile();
	// no longer exists in Selenium
	// profile.setEnableNativeEvents(true);
	profile.setAcceptUntrustedCertificates(true);
	profile.setAssumeUntrustedCertificateIssuer(false);

	// Disable Firefox Auto-Updating
	profile.setPreference("app.update.auto", false);
	profile.setPreference("app.update.enabled", false);

	capabilities.setCapability(FirefoxDriver.PROFILE, profile);
	capabilities.setCapability("elementScrollBehavior", 1);
	capabilities.setBrowserName(DesiredCapabilities.firefox().getBrowserName());
	return capabilities;
}
 
開發者ID:sergueik,項目名稱:SWET,代碼行數:49,代碼來源:BrowserDriver.java

示例10: firefox

import org.openqa.selenium.remote.DesiredCapabilities; //導入方法依賴的package包/類
public Builder firefox() {
    this.browserCaps = DesiredCapabilities.firefox();
    return this;
}
 
開發者ID:italia,項目名稱:daf-cacher,代碼行數:5,代碼來源:Browser.java


注:本文中的org.openqa.selenium.remote.DesiredCapabilities.firefox方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。