Java Code Examples for org.openqa.selenium.firefox.FirefoxProfile#setEnableNativeEvents()

The following examples show how to use org.openqa.selenium.firefox.FirefoxProfile#setEnableNativeEvents() . 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 File: JiraIssueCreation.java    From rice with Educational Community License v2.0 6 votes vote down vote up
private void login() throws InterruptedException {DesiredCapabilities capabilities = new DesiredCapabilities();
    FirefoxProfile profile = new FirefoxProfile();
    profile.setEnableNativeEvents(false);
    capabilities.setCapability(FirefoxDriver.PROFILE, profile);

    driver = new FirefoxDriver(capabilities);
    driver.manage().timeouts().implicitlyWait(WebDriverUtils.configuredImplicityWait(), TimeUnit.SECONDS);
    driver.get(jiraBase + "/secure/Dashboard.jspa");

    WebDriverUtils.waitFor(driver, WebDriverUtils.configuredImplicityWait(), By.className("login-link"),
            this.getClass().toString()).click();

    // CAS
    WebDriverUtils.waitFor(driver, WebDriverUtils.configuredImplicityWait(), By.id("username"),
            this.getClass().toString());
    driver.findElement(By.id("username")).sendKeys(System.getProperty("cas.username"));
    driver.findElement(By.id("password")).sendKeys(System.getProperty("cas.password"));
    driver.findElement(By.name("submit")).click();
}
 
Example 2
Source File: FirefoxDriverResource.java    From adf-selenium with Apache License 2.0 5 votes vote down vote up
protected FirefoxProfile createProfile(String language) {
    FirefoxProfile profile = new FirefoxProfile();
    // native events cause "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsINativeMouse.click]"
    // on Windows with multiple calls to AdfSelectOneChoice.clickItemByIndex (and others)
    profile.setEnableNativeEvents(false);
    profile.setPreference("app.update.enabled", false); // don't bother updating Firefox (takes too much time)
    profile.setPreference("browser.usedOnWindows10", true); // don't show first-time windows 10 welcome page
    profile.setPreference("intl.accept_languages", language);
    return profile;
}
 
Example 3
Source File: BotStyleTest.java    From adf-selenium with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
    final FirefoxProfile profile = new FirefoxProfile();
    profile.setEnableNativeEvents(true);
    profile.setPreference("app.update.enabled", false);
    driver = new FirefoxDriver(profile);

    DialogManager.init(driver, TIMEOUT_MSECS);
    dialogManager = DialogManager.getInstance();
}
 
Example 4
Source File: TestBrowserFactory.java    From webtester-core with Apache License 2.0 5 votes vote down vote up
@Override
public Browser createBrowser() {
    FirefoxProfile profile = new FirefoxProfile();
    profile.setAcceptUntrustedCertificates(true);
    profile.setEnableNativeEvents(false);
    return createBrowser(new FirefoxDriver(profile));
}
 
Example 5
Source File: WebDriverUtils.java    From rice with Educational Community License v2.0 5 votes vote down vote up
/**
 * <p>
 * remote.public.driver set to chrome or firefox (null assumes firefox).
 * </p><p>
 * if remote.public.hub is set a RemoteWebDriver is created (Selenium Grid)
 * if proxy.host is set, the web driver is setup to use a proxy
 * </p>
 *
 * @return WebDriver or null if unable to create
 */
public static WebDriver getWebDriver() {
    String driverParam = System.getProperty(HUB_DRIVER_PROPERTY);
    String hubParam = System.getProperty(HUB_PROPERTY);
    String proxyParam = System.getProperty(PROXY_HOST_PROPERTY);

    // setup proxy if specified as VM Arg
    DesiredCapabilities capabilities = new DesiredCapabilities();
    WebDriver webDriver = null;
    if (StringUtils.isNotEmpty(proxyParam)) {
        capabilities.setCapability(CapabilityType.PROXY, new Proxy().setHttpProxy(proxyParam));
    }

    if (hubParam == null) {
        if (driverParam == null || "firefox".equalsIgnoreCase(driverParam)) {
            FirefoxProfile profile = new FirefoxProfile();
            profile.setEnableNativeEvents(false);
            capabilities.setCapability(FirefoxDriver.PROFILE, profile);
            return new FirefoxDriver(capabilities);
        } else if ("chrome".equalsIgnoreCase(driverParam)) {
            return new ChromeDriver(capabilities);
        } else if ("safari".equals(driverParam)) {
            System.out.println("SafariDriver probably won't work, if it does please contact Erik M.");
            return new SafariDriver(capabilities);
        }
    } else {
        try {
            if (driverParam == null || "firefox".equalsIgnoreCase(driverParam)) {
                return new RemoteWebDriver(new URL(getHubUrlString()), DesiredCapabilities.firefox());
            } else if ("chrome".equalsIgnoreCase(driverParam)) {
                return new RemoteWebDriver(new URL(getHubUrlString()), DesiredCapabilities.chrome());
            }
        } catch (MalformedURLException mue) {
            System.out.println(getHubUrlString() + " " + mue.getMessage());
            mue.printStackTrace();
        }
    }
    return null;
}
 
Example 6
Source File: AaarghFirefoxWhyDostThouMockMe.java    From webDriverExperiments with MIT License 3 votes vote down vote up
@Test
public void simpleUserInteractionInFirefox(){

    FirefoxProfile profile = new FirefoxProfile();
    profile.setEnableNativeEvents(true);
    driver = new FirefoxDriver(profile);

    checkSimpleCtrlBInteractionWorks();


}
 
Example 7
Source File: AaarghFirefoxWhyDostThouMockMe.java    From webDriverExperiments with MIT License 3 votes vote down vote up
@Test
public void simpleUserInteractionInFirefox(){

    FirefoxProfile profile = new FirefoxProfile();
    profile.setEnableNativeEvents(true);
    driver = new FirefoxDriver(profile);

    checkSimpleCtrlBInteractionWorks();


}