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


Java FirefoxProfile.setAcceptUntrustedCertificates方法代码示例

本文整理汇总了Java中org.openqa.selenium.firefox.FirefoxProfile.setAcceptUntrustedCertificates方法的典型用法代码示例。如果您正苦于以下问题:Java FirefoxProfile.setAcceptUntrustedCertificates方法的具体用法?Java FirefoxProfile.setAcceptUntrustedCertificates怎么用?Java FirefoxProfile.setAcceptUntrustedCertificates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openqa.selenium.firefox.FirefoxProfile的用法示例。


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

示例1: Firefox

import org.openqa.selenium.firefox.FirefoxProfile; //导入方法依赖的package包/类
/**
 * 本地初始化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);
        }
    }
}
 
开发者ID:Airpy,项目名称:KeywordDrivenAutoTest,代码行数:22,代码来源:Firefox.java

示例2: createWebDriver

import org.openqa.selenium.firefox.FirefoxProfile; //导入方法依赖的package包/类
@Override
public WebCommunicationWrapper createWebDriver(ProxyServerWrapper proxyServer)
    throws WorkerException {
  try {
    Proxy proxy = proxyServer.seleniumProxy();
    proxyServer.setCaptureContent(true);
    proxyServer.setCaptureHeaders(true);

    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(CapabilityType.PROXY, proxy);
    capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);

    FirefoxProfile fp = getFirefoxProfile();
    fp.setAcceptUntrustedCertificates(true);
    fp.setAssumeUntrustedCertificateIssuer(false);
    capabilities.setCapability(AetFirefoxDriver.PROFILE, fp);

    return new WebCommunicationWrapperImpl(getFirefoxDriver(fp, capabilities), proxyServer,
        requestExecutorFactory
            .createInstance());
  } catch (Exception e) {
    throw new WorkerException(e.getMessage(), e);
  }
}
 
开发者ID:Cognifide,项目名称:aet,代码行数:25,代码来源:FirefoxWebDriverFactory.java

示例3: createFireFoxDriver

import org.openqa.selenium.firefox.FirefoxProfile; //导入方法依赖的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

示例4: buildFirefoxBrowser

import org.openqa.selenium.firefox.FirefoxProfile; //导入方法依赖的package包/类
public static FirefoxBrowser buildFirefoxBrowser() {
    FirefoxProfile profile = new FirefoxProfile();
    profile.setAcceptUntrustedCertificates(true);

    FirefoxBrowser browser = new FirefoxBrowser(profile);
    browser.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
    return browser;
}
 
开发者ID:natritmeyer,项目名称:cucumber-jvm-java-maven-parallel-picocontainer-selenium-webdriver-pagefactory-skeleton,代码行数:9,代码来源:FirefoxBrowser.java

示例5: getFirefoxProfile

import org.openqa.selenium.firefox.FirefoxProfile; //导入方法依赖的package包/类
@Override
public FirefoxProfile getFirefoxProfile() {
    FirefoxProfile firefoxProfile = new FirefoxProfile();
    processOptionValues(firefoxProfilePreferencePairs, (name, value) -> {
        if (value instanceof Integer) firefoxProfile.setPreference(name, (Integer)value);
        if (value instanceof Boolean) firefoxProfile.setPreference(name, (Boolean)value);
        if (value instanceof String) firefoxProfile.setPreference(name, (String)value);
    });
    firefoxProfile.setAcceptUntrustedCertificates(firefoxProfileTrustAllCerts);
    return firefoxProfile;
}
 
开发者ID:andyphillips404,项目名称:awplab-core,代码行数:12,代码来源:SeleniumProvider.java

示例6: getFirefoxCapabilities

import org.openqa.selenium.firefox.FirefoxProfile; //导入方法依赖的package包/类
public Capabilities getFirefoxCapabilities() {
	DesiredCapabilities firefox = DesiredCapabilities.firefox();
	FirefoxProfile profile = new FirefoxProfile();
	profile.setAcceptUntrustedCertificates(true);
	profile.setAssumeUntrustedCertificateIssuer(true);
	firefox.setCapability(FirefoxDriver.PROFILE, profile);
	firefox.setCapability("marionette", true);
	return firefox;
}
 
开发者ID:rahulrathore44,项目名称:SeleniumCucumber,代码行数:10,代码来源:FirefoxBrowser.java

示例7: configProfile

import org.openqa.selenium.firefox.FirefoxProfile; //导入方法依赖的package包/类
protected void configProfile(final FirefoxProfile profile, final DriverConfig webDriverConfig) {
    profile.setAcceptUntrustedCertificates(webDriverConfig.isSetAcceptUntrustedCertificates());
    profile.setAssumeUntrustedCertificateIssuer(webDriverConfig.isSetAssumeUntrustedCertificateIssuer());

    if (webDriverConfig.getFirefoxBinPath() != null) {
        System.setProperty("webdriver.firefox.bin", webDriverConfig.getFirefoxBinPath());
    }

    if (webDriverConfig.getUserAgentOverride() != null) {
        profile.setPreference("general.useragent.override", webDriverConfig.getUserAgentOverride());
    }

    if (webDriverConfig.getNtlmAuthTrustedUris() != null) {
        profile.setPreference("network.automatic-ntlm-auth.trusted-uris", webDriverConfig.getNtlmAuthTrustedUris());
    }

    if (webDriverConfig.getBrowserDownloadDir() != null) {
        profile.setPreference("browser.download.dir", webDriverConfig.getBrowserDownloadDir());
        profile.setPreference("browser.download.folderList", 2);
        profile.setPreference("browser.download.manager.showWhenStarting", false);
        profile.setPreference("browser.helperApps.neverAsk.saveToDisk",
            "application/octet-stream,text/plain,application/pdf,application/zip,text/csv,text/html");
    }

    if (!webDriverConfig.isEnableJavascript()) {
        profile.setPreference("javascript.enabled", false);
    }

    // fix permission denied issues
    profile.setPreference("capability.policy.default.Window.QueryInterface", "allAccess");
    profile.setPreference("capability.policy.default.Window.frameElement.get", "allAccess");
    profile.setPreference("capability.policy.default.HTMLDocument.compatMode.get", "allAccess");
    profile.setPreference("capability.policy.default.Document.compatMode.get", "allAccess");
    profile.setPreference("dom.max_chrome_script_run_time", 0);
    profile.setPreference("dom.max_script_run_time", 0);
}
 
开发者ID:tarun3kumar,项目名称:seleniumtestsframework,代码行数:37,代码来源:FirefoxCapabilitiesFactory.java

示例8: produceDriver

import org.openqa.selenium.firefox.FirefoxProfile; //导入方法依赖的package包/类
@Override
public synchronized RemoteWebDriver produceDriver() {
    LOGGER.debug("Returning new driver");
    if (drivers.isEmpty()) {
        LOGGER.debug("Creating new driver");
        FirefoxProfile profile = new FirefoxProfile();
        profile.setAcceptUntrustedCertificates(true);
        RemoteWebDriver ff = new FirefoxDriver(profile);
        return ff;
    } else {
        LOGGER.debug("Returning {} driver from pool", drivers.peek().getWindowHandle());
        return drivers.poll();
    }
}
 
开发者ID:watchrabbit,项目名称:rabbit-crawler,代码行数:15,代码来源:FirefoxWebDriverFactory.java

示例9: createBrowser

import org.openqa.selenium.firefox.FirefoxProfile; //导入方法依赖的package包/类
@Override
public Browser createBrowser() {
    FirefoxProfile profile = new FirefoxProfile();
    profile.setAcceptUntrustedCertificates(true);
    profile.setEnableNativeEvents(false);
    return createBrowser(new FirefoxDriver(profile));
}
 
开发者ID:testIT-WebTester,项目名称:webtester-core,代码行数:8,代码来源:TestBrowserFactory.java

示例10: createFirefoxBrowser

import org.openqa.selenium.firefox.FirefoxProfile; //导入方法依赖的package包/类
private void createFirefoxBrowser(DesiredCapabilities capabilities) throws MalformedURLException {
  FirefoxProfile profile = new FirefoxProfile();
  // This flag avoids granting the access to the camera
  profile.setPreference("media.navigator.permission.disabled", true);

  // This flag force to use fake user media (synthetic video of multiple color)
  profile.setPreference("media.navigator.streams.fake", true);

  // This allows to load pages with self-signed certificates
  capabilities.setCapability("acceptInsecureCerts", true);
  profile.setAcceptUntrustedCertificates(true);

  capabilities.setCapability(FirefoxDriver.PROFILE, profile);
  capabilities.setBrowserName(DesiredCapabilities.firefox().getBrowserName());

  // Firefox extensions
  if (extensions != null && !extensions.isEmpty()) {
    for (Map<String, String> extension : extensions) {
      InputStream is = getExtensionAsInputStream(extension.values().iterator().next());
      if (is != null) {
        try {
          File xpi = File.createTempFile(extension.keySet().iterator().next(), ".xpi");
          FileUtils.copyInputStreamToFile(is, xpi);
          profile.addExtension(xpi);
        } catch (Throwable t) {
          log.error("Error loading Firefox extension {} ({} : {})", extension, t.getClass(),
              t.getMessage());
        }
      }
    }
  }

  createDriver(capabilities, profile);
}
 
开发者ID:Kurento,项目名称:kurento-java,代码行数:35,代码来源:Browser.java

示例11: initFirefoxDriver

import org.openqa.selenium.firefox.FirefoxProfile; //导入方法依赖的package包/类
/**
 * initialization FirefoxDriver
 */
public static void initFirefoxDriver() {
    ReporterNGExt.logTechnical("Initialization Firefox Driver");
    FirefoxProfile profile = new FirefoxProfile();
    profile.setAcceptUntrustedCertificates(true);
    profile.setAssumeUntrustedCertificateIssuer(true);
    profile.setEnableNativeEvents(true);
    profile.setPreference("javascript.enabled", true);
    profile.setPreference("dom.max_script_run_time", 0);
    profile.setPreference("dom.max_chrome_script_run_time", 0);
    setWebDriver(new FirefoxDriver(profile));
    setTimeout(TIMEOUT);
    getDriver().manage().window().maximize();
}
 
开发者ID:ggasoftware,项目名称:gga-selenium-framework,代码行数:17,代码来源:WebDriverWrapper.java

示例12: capabilitiesFirefox

import org.openqa.selenium.firefox.FirefoxProfile; //导入方法依赖的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


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