Example usage for org.openqa.selenium UnexpectedAlertBehaviour IGNORE

List of usage examples for org.openqa.selenium UnexpectedAlertBehaviour IGNORE

Introduction

In this page you can find the example usage for org.openqa.selenium UnexpectedAlertBehaviour IGNORE.

Prototype

UnexpectedAlertBehaviour IGNORE

To view the source code for org.openqa.selenium UnexpectedAlertBehaviour IGNORE.

Click Source Link

Usage

From source file:com.redspr.redrobot.WebDriverRobot.java

License:Open Source License

public WebDriverRobot() {
    DesiredCapabilities dc = DesiredCapabilities.firefox();
    dc.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR, UnexpectedAlertBehaviour.IGNORE);
    WebDriver ff = new FirefoxDriver(dc);

    init(ff);//from www.ja v  a2s. c  o m
}

From source file:io.openvidu.test.browsers.ChromeUser.java

License:Apache License

private ChromeUser(String userName, int timeOfWaitInSeconds, ChromeOptions options) {
    super(userName, timeOfWaitInSeconds);
    options.setAcceptInsecureCerts(true);
    options.setUnhandledPromptBehaviour(UnexpectedAlertBehaviour.IGNORE);

    options.addArguments("--disable-infobars");

    Map<String, Object> prefs = new HashMap<String, Object>();
    prefs.put("profile.default_content_setting_values.media_stream_mic", 1);
    prefs.put("profile.default_content_setting_values.media_stream_camera", 1);
    options.setExperimentalOption("prefs", prefs);

    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 {// w  w  w . j  a  v  a  2  s.c om
            this.driver = new RemoteWebDriver(new URL(REMOTE_URL), options);
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }
    } else {
        log.info("Using local web driver");
        this.driver = new ChromeDriver(options);
    }

    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 ww w  .java  2  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();
}

From source file:mbaf.galileoprojselenium.WebDriver.WebDriverGC.java

@Override
public ChromeDriver getWebDriver() {

    DesiredCapabilities dc = new DesiredCapabilities();
    dc.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR, UnexpectedAlertBehaviour.IGNORE);

    System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
    return new ChromeDriver(dc);
}