List of usage examples for org.openqa.selenium.remote DesiredCapabilities setAcceptInsecureCerts
public void setAcceptInsecureCerts(boolean acceptInsecureCerts)
From source file:io.openvidu.test.browsers.ChromeAndroidUser.java
License:Apache License
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 {/*from w w w. j a v a 2s.c om*/ 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(); }
From source file:io.openvidu.test.browsers.FirefoxUser.java
License:Apache License
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 {/*from w w w. j a v a2 s. c o m*/ 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(); }