本文整理匯總了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();
}