当前位置: 首页>>代码示例>>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;未经允许,请勿转载。