本文整理汇总了Java中org.openqa.selenium.firefox.FirefoxProfile.setEnableNativeEvents方法的典型用法代码示例。如果您正苦于以下问题:Java FirefoxProfile.setEnableNativeEvents方法的具体用法?Java FirefoxProfile.setEnableNativeEvents怎么用?Java FirefoxProfile.setEnableNativeEvents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openqa.selenium.firefox.FirefoxProfile
的用法示例。
在下文中一共展示了FirefoxProfile.setEnableNativeEvents方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: login
import org.openqa.selenium.firefox.FirefoxProfile; //导入方法依赖的package包/类
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: create
import org.openqa.selenium.firefox.FirefoxProfile; //导入方法依赖的package包/类
@Override
public WebDriver create() {
DesiredCapabilities capability = DesiredCapabilities.firefox();
FirefoxProfile profile = new FirefoxProfile();
profile.setEnableNativeEvents(true);
capability.setCapability(FirefoxDriver.PROFILE, profile);
WebDriver driver = null;
try {
driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capability);
//SessionId sessionId = ((RemoteWebDriver) driver).getSessionId();
//log.info("Running test on node: " + SeleniumGridHandler.getNodeIpBySessionId(sessionId));
} catch (MalformedURLException e) {
e.printStackTrace();
}
return driver;
}
示例3: getProfile
import org.openqa.selenium.firefox.FirefoxProfile; //导入方法依赖的package包/类
private FirefoxProfile getProfile() {
FirefoxProfile profile = new FirefoxProfile();
String[] options = Configuration.getProperty("firefox.properties").split("\\s*,\\s*");
for (String option : options) {
String lineRegex = "([^=]+)=(.+)$";
Pattern p = Pattern.compile(lineRegex);
Matcher m = p.matcher(option);
String key = null;
String value = null;
if (m.find(0)) {
key = m.group(1);
value = m.group(2).trim();
}
if (key == null) throw new RuntimeException("Unable to parse configuration option: " + option);
if (value.matches("\\d+")) {
profile.setPreference(key, Integer.parseInt(value));
} else if (value.matches("true|false")) {
profile.setPreference(key, Boolean.parseBoolean(value));
} else {
profile.setPreference(key, value);
}
}
profile.setEnableNativeEvents(false);
return profile;
}
示例4: createFireFoxDriver
import org.openqa.selenium.firefox.FirefoxProfile; //导入方法依赖的package包/类
private static WebDriver createFireFoxDriver() {
FirefoxProfile firefoxProfile = new FirefoxProfile();
firefoxProfile.setEnableNativeEvents(false);
firefoxProfile.setAcceptUntrustedCertificates(true);
firefoxProfile.setPreference("layers.acceleration.disabled", true);
DesiredCapabilities desiredCapabilities = DesiredCapabilities.firefox();
desiredCapabilities.setCapability(FirefoxDriver.PROFILE, firefoxProfile);
return new FirefoxDriver(desiredCapabilities);
}
示例5: createProfile
import org.openqa.selenium.firefox.FirefoxProfile; //导入方法依赖的package包/类
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;
}
示例6: setup
import org.openqa.selenium.firefox.FirefoxProfile; //导入方法依赖的package包/类
@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();
}
示例7: getWebDriver
import org.openqa.selenium.firefox.FirefoxProfile; //导入方法依赖的package包/类
/**
* <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;
}
示例8: createBrowser
import org.openqa.selenium.firefox.FirefoxProfile; //导入方法依赖的package包/类
@Override
public Browser createBrowser() {
FirefoxProfile profile = new FirefoxProfile();
profile.setAcceptUntrustedCertificates(true);
profile.setEnableNativeEvents(false);
return createBrowser(new FirefoxDriver(profile));
}
示例9: loadFirefoxProfile
import org.openqa.selenium.firefox.FirefoxProfile; //导入方法依赖的package包/类
/**
* Returns the basic firefox profile. Override this method to add custom
* profile.
*/
protected FirefoxProfile loadFirefoxProfile(WTFCountry country) {
FirefoxProfile profile = new FirefoxProfile();
profile.setEnableNativeEvents(true);
profile.setAssumeUntrustedCertificateIssuer(true);
if (country != null) {
System.out
.println("Setting firefox profile with intl.accept_langauges as '"
+ country.toString() + "'");
profile.setPreference("intl.accept_languages", country.toString()
.toLowerCase());
}
return profile;
}
示例10: initFFProfile
import org.openqa.selenium.firefox.FirefoxProfile; //导入方法依赖的package包/类
/**
* initialization FF with some profile
* Use it if you want to use your profile for FF. It doesn't work remotely.
* Before running create your profile. Use cmd : firefox.exe -ProfileManager -no-remote
*
* @param path - profile path
*/
public static void initFFProfile(String path) {
ReporterNGExt.logTechnical(String.format("Initialization Firefox Driver with Profile '%s'", path));
File profileDir = new File(path);
FirefoxProfile ffprofile = new FirefoxProfile(profileDir);
ffprofile.setEnableNativeEvents(true);
setWebDriver(new FirefoxDriver(ffprofile));
getDriver().manage().window().maximize();
}
示例11: initFirefoxDriver
import org.openqa.selenium.firefox.FirefoxProfile; //导入方法依赖的package包/类
/**
* initialization FirefoxDriver
*/
public static void initFirefoxDriver() {
ReporterNGExt.logTechnical("Initialization Firefox Driver");
FirefoxProfile profile = new FirefoxProfile();
profile.setAcceptUntrustedCertificates(true);
profile.setAssumeUntrustedCertificateIssuer(true);
profile.setEnableNativeEvents(true);
profile.setPreference("javascript.enabled", true);
profile.setPreference("dom.max_script_run_time", 0);
profile.setPreference("dom.max_chrome_script_run_time", 0);
setWebDriver(new FirefoxDriver(profile));
setTimeout(TIMEOUT);
getDriver().manage().window().maximize();
}
示例12: simpleUserInteractionInFirefox
import org.openqa.selenium.firefox.FirefoxProfile; //导入方法依赖的package包/类
@Test
public void simpleUserInteractionInFirefox(){
FirefoxProfile profile = new FirefoxProfile();
profile.setEnableNativeEvents(true);
driver = new FirefoxDriver(profile);
checkSimpleCtrlBInteractionWorks();
}