本文整理汇总了Java中org.openqa.selenium.remote.DesiredCapabilities.internetExplorer方法的典型用法代码示例。如果您正苦于以下问题:Java DesiredCapabilities.internetExplorer方法的具体用法?Java DesiredCapabilities.internetExplorer怎么用?Java DesiredCapabilities.internetExplorer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openqa.selenium.remote.DesiredCapabilities
的用法示例。
在下文中一共展示了DesiredCapabilities.internetExplorer方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: capabilitiesInternetExplorer
import org.openqa.selenium.remote.DesiredCapabilities; //导入方法依赖的package包/类
private static DesiredCapabilities capabilitiesInternetExplorer() {
DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
final String ieDriverPath = (applicationIeDriverPath == null)
? "c:/java/selenium/IEDriverServer.exe" : applicationIeDriverPath;
System.setProperty("webdriver.ie.driver", ieDriverPath
/* (new File(ieDriverPath)).getAbsolutePath() */);
capabilities.setCapability(
InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,
true);
capabilities.setCapability("ignoreZoomSetting", true);
capabilities.setCapability("ignoreProtectedModeSettings", true);
capabilities.setCapability("requireWindowFocus", true);
capabilities.setBrowserName(
DesiredCapabilities.internetExplorer().getBrowserName());
return capabilities;
}
示例2: initIEDriver
import org.openqa.selenium.remote.DesiredCapabilities; //导入方法依赖的package包/类
private WebDriver initIEDriver(String appURL) {
System.out.println("Launching IE browser..");
DesiredCapabilities ieCapabilities = DesiredCapabilities.internetExplorer();
ieCapabilities.setJavascriptEnabled(true);
ieCapabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS,
true);
ieCapabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,true);
ieCapabilities.setCapability(InternetExplorerDriver.IGNORE_ZOOM_SETTING,true);
ieCapabilities.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR,UnexpectedAlertBehaviour.DISMISS); //Accept unexpected alerts
ieCapabilities.setCapability("requireWindowFocus", true);
ieCapabilities.setCapability("enablePersistentHover", false);
ieCapabilities.setCapability(CapabilityType.ForSeleniumServer.ENSURING_CLEAN_SESSION, true);
WebDriver driver=new InternetExplorerDriver(ieCapabilities);
driver.manage().deleteAllCookies();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
for(String winHandle : driver.getWindowHandles()){
driver = driver.switchTo().window(winHandle);
}
driver.get(appURL);
return new WebDriverProxy().protect(driver);
}
示例3: getEdgeDriver
import org.openqa.selenium.remote.DesiredCapabilities; //导入方法依赖的package包/类
public static WebDriver getEdgeDriver()
{
String path = System.getProperty("user.dir") + "\\Drivers\\EdgeWebDriver.exe";
System.setProperty("webdriver.ie.driver", path);
DesiredCapabilities caps = DesiredCapabilities.internetExplorer();
caps.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
return new InternetExplorerDriver(caps);
}
示例4: get32IEDriver
import org.openqa.selenium.remote.DesiredCapabilities; //导入方法依赖的package包/类
public static WebDriver get32IEDriver()
{
String path = System.getProperty("user.dir") + "\\Drivers\\IEDriverServer32.exe";
System.setProperty("webdriver.ie.driver", path);
DesiredCapabilities caps = DesiredCapabilities.internetExplorer();
caps.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
return new InternetExplorerDriver(caps);
}
示例5: get64IEDriver
import org.openqa.selenium.remote.DesiredCapabilities; //导入方法依赖的package包/类
public static WebDriver get64IEDriver()
{
String path = System.getProperty("user.dir") + "\\Drivers\\IEDriverServer64.exe";
System.setProperty("webdriver.ie.driver", path);
DesiredCapabilities caps = DesiredCapabilities.internetExplorer();
caps.setCapability(CapabilityType.BROWSER_NAME, "IE");
caps.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
return new InternetExplorerDriver(caps);
}
示例6: ie
import org.openqa.selenium.remote.DesiredCapabilities; //导入方法依赖的package包/类
/**
* ie浏览器
*/
private void ie()
{
String initialUrl = enginePro.getProperty(DriverConstants.INITIAL_URL,
"http://surenpi.com");
DesiredCapabilities capability = DesiredCapabilities.internetExplorer();
capability.setCapability(
InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
capability.setCapability(InternetExplorerDriver.INITIAL_BROWSER_URL, initialUrl);
capability.setCapability(InternetExplorerDriver.REQUIRE_WINDOW_FOCUS, false);
engineCapMap.put(DRIVER_IE, capability);
}
示例7: generateIEDriver
import org.openqa.selenium.remote.DesiredCapabilities; //导入方法依赖的package包/类
/**
* Generates an ie webdriver. Unable to use it with a proxy. Causes a crash.
*
* @return
* An ie webdriver
* @throws TechnicalException
* if an error occured when Webdriver setExecutable to true.
*/
private WebDriver generateIEDriver() throws TechnicalException {
final String pathWebdriver = DriverFactory.getPath(Driver.IE);
if (!new File(pathWebdriver).setExecutable(true)) {
throw new TechnicalException(Messages.getMessage(TechnicalException.TECHNICAL_ERROR_MESSAGE_WEBDRIVER_SET_EXECUTABLE));
}
logger.info("Generating IE driver ({}) ...", pathWebdriver);
System.setProperty(Driver.IE.getDriverName(), pathWebdriver);
final DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true);
capabilities.setCapability(InternetExplorerDriver.IGNORE_ZOOM_SETTING, true);
capabilities.setCapability(InternetExplorerDriver.REQUIRE_WINDOW_FOCUS, true);
capabilities.setCapability(InternetExplorerDriver.NATIVE_EVENTS, false);
capabilities.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR, UnexpectedAlertBehaviour.ACCEPT);
capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
capabilities.setCapability("disable-popup-blocking", true);
capabilities.setJavascriptEnabled(true);
setLoggingLevel(capabilities);
// Proxy configuration
if (Context.getProxy().getProxyType() != ProxyType.UNSPECIFIED && Context.getProxy().getProxyType() != ProxyType.AUTODETECT) {
capabilities.setCapability(CapabilityType.PROXY, Context.getProxy());
}
return new InternetExplorerDriver(capabilities);
}
示例8: ieDriver
import org.openqa.selenium.remote.DesiredCapabilities; //导入方法依赖的package包/类
protected void ieDriver() {
DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability(InternetExplorerDriver.NATIVE_EVENTS, false);
capabilities.setCapability(InternetExplorerDriver.ENABLE_PERSISTENT_HOVERING, false);
capabilities.setCapability(InternetExplorerDriver.REQUIRE_WINDOW_FOCUS, false);
capabilities.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true);
capabilities.setCapability(InternetExplorerDriver.IGNORE_ZOOM_SETTING, true);
capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
System.setProperty("webdriver.ie.driver","./src/main/resources/iedriver/IEDriverServer.exe");
driver = new InternetExplorerDriver(capabilities);
driver.manage().window().maximize();
}