org.openqa.selenium.firefox.FirefoxProfile#setEnableNativeEvents ( )源码实例Demo

下面列出了org.openqa.selenium.firefox.FirefoxProfile#setEnableNativeEvents ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: rice   文件: JiraIssueCreation.java
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();
}
 
源代码2 项目: adf-selenium   文件: FirefoxDriverResource.java
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;
}
 
源代码3 项目: adf-selenium   文件: BotStyleTest.java
@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();
}
 
源代码4 项目: webtester-core   文件: TestBrowserFactory.java
@Override
public Browser createBrowser() {
    FirefoxProfile profile = new FirefoxProfile();
    profile.setAcceptUntrustedCertificates(true);
    profile.setEnableNativeEvents(false);
    return createBrowser(new FirefoxDriver(profile));
}
 
源代码5 项目: rice   文件: WebDriverUtils.java
/**
 * <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;
}
 
@Test
public void simpleUserInteractionInFirefox(){

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

    checkSimpleCtrlBInteractionWorks();


}
 
@Test
public void simpleUserInteractionInFirefox(){

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

    checkSimpleCtrlBInteractionWorks();


}