Java Code Examples for org.openqa.selenium.remote.DesiredCapabilities#setAcceptInsecureCerts()

The following examples show how to use org.openqa.selenium.remote.DesiredCapabilities#setAcceptInsecureCerts() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: openvidu   File: FirefoxUser.java    License: Apache License 2.0 5 votes vote down vote up
public FirefoxUser(String userName, int timeOfWaitInSeconds) {
	super(userName, timeOfWaitInSeconds);

	DesiredCapabilities capabilities = DesiredCapabilities.firefox();
	capabilities.setAcceptInsecureCerts(true);
	capabilities.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR, UnexpectedAlertBehaviour.IGNORE);
	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);

	capabilities.setCapability(FirefoxDriver.PROFILE, profile);

	String REMOTE_URL = System.getProperty("REMOTE_URL_FIREFOX");
	if (REMOTE_URL != null) {
		log.info("Using URL {} to connect to remote web driver", REMOTE_URL);
		try {
			this.driver = new RemoteWebDriver(new URL(REMOTE_URL), capabilities);
		} catch (MalformedURLException e) {
			e.printStackTrace();
		}
	} else {
		log.info("Using local web driver");
		this.driver = new FirefoxDriver(capabilities);
	}

	this.configureDriver();
}
 
Example 2
Source Project: openvidu   File: ChromeAndroidUser.java    License: Apache License 2.0 5 votes vote down vote up
public ChromeAndroidUser(String userName, int timeOfWaitInSeconds) {
	super(userName, timeOfWaitInSeconds);

	Map<String, String> mobileEmulation = new HashMap<>();
	mobileEmulation.put("deviceName", "Pixel 2");

	ChromeOptions chromeOptions = new ChromeOptions();
	chromeOptions.setExperimentalOption("mobileEmulation", mobileEmulation);

	DesiredCapabilities capabilities = DesiredCapabilities.chrome();
	capabilities.setAcceptInsecureCerts(true);
	capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);

	// This flag avoids to grant the user media
	chromeOptions.addArguments("--use-fake-ui-for-media-stream");
	// This flag fakes user media with synthetic video
	chromeOptions.addArguments("--use-fake-device-for-media-stream");

	String REMOTE_URL = System.getProperty("REMOTE_URL_CHROME");
	if (REMOTE_URL != null) {
		log.info("Using URL {} to connect to remote web driver", REMOTE_URL);
		try {
			this.driver = new RemoteWebDriver(new URL(REMOTE_URL), capabilities);
		} catch (MalformedURLException e) {
			e.printStackTrace();
		}
	} else {
		log.info("Using local web driver");
		this.driver = new ChromeDriver(capabilities);
	}

	this.driver.manage().timeouts().setScriptTimeout(this.timeOfWaitInSeconds, TimeUnit.SECONDS);
	this.configureDriver();
}
 
Example 3
Source Project: openvidu   File: OperaUser.java    License: Apache License 2.0 5 votes vote down vote up
public OperaUser(String userName, int timeOfWaitInSeconds) {
	super(userName, timeOfWaitInSeconds);

	OperaOptions options = new OperaOptions();
	options.setBinary("/usr/bin/opera");
	DesiredCapabilities capabilities = DesiredCapabilities.operaBlink();
	capabilities.setAcceptInsecureCerts(true);
	capabilities.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR, UnexpectedAlertBehaviour.IGNORE);

	options.addArguments("--use-fake-ui-for-media-stream");
	options.addArguments("--use-fake-device-for-media-stream");
	capabilities.setCapability(OperaOptions.CAPABILITY, options);

	String REMOTE_URL = System.getProperty("REMOTE_URL_OPERA");
	if (REMOTE_URL != null) {
		log.info("Using URL {} to connect to remote web driver", REMOTE_URL);
		try {
			this.driver = new RemoteWebDriver(new URL(REMOTE_URL), capabilities);
		} catch (MalformedURLException e) {
			e.printStackTrace();
		}
	} else {
		log.info("Using local web driver");
		this.driver = new OperaDriver(capabilities);
	}

	this.driver.manage().timeouts().setScriptTimeout(this.timeOfWaitInSeconds, TimeUnit.SECONDS);
	this.configureDriver();
}