本文整理汇总了Java中org.openqa.selenium.ie.InternetExplorerDriver类的典型用法代码示例。如果您正苦于以下问题:Java InternetExplorerDriver类的具体用法?Java InternetExplorerDriver怎么用?Java InternetExplorerDriver使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InternetExplorerDriver类属于org.openqa.selenium.ie包,在下文中一共展示了InternetExplorerDriver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDriver
import org.openqa.selenium.ie.InternetExplorerDriver; //导入依赖的package包/类
public static WebDriver getDriver() {
String browser = System.getenv("BROWSER");
if (browser == null) {
ChromeDriverManager.getInstance().setup();
return new ChromeDriver();
}
switch (browser)
{
case "IE":
InternetExplorerDriverManager.getInstance().setup();
return new InternetExplorerDriver();
case "FIREFOX":
FirefoxDriverManager.getInstance().setup();
return new FirefoxDriver();
default:
ChromeDriverManager.getInstance().setup();
return new ChromeDriver();
}
}
示例2: selectLocalBrowser
import org.openqa.selenium.ie.InternetExplorerDriver; //导入依赖的package包/类
public static WebDriver selectLocalBrowser() {
switch (browser) {
case Chrome:
return new ChromeDriver();
case Firefox:
return new FirefoxDriver();
case IE:
return new InternetExplorerDriver();
case Opera:
return new OperaDriver();
case Safari:
return new SafariDriver();
default:
throw new WebDriverException("No browser specified");
}
}
示例3: create
import org.openqa.selenium.ie.InternetExplorerDriver; //导入依赖的package包/类
@Override
public WebDriver create() {
DesiredCapabilities ieCapabilities = DesiredCapabilities.internetExplorer();
ieCapabilities.setCapability("unexpectedAlertBehaviour" , "ignore");
//ieCapabilities.setCapability("enablePersistentHover", true);
//TM:22/01/2014- Added following for GAIC
ieCapabilities
.setCapability(
InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,
true);// Add this desiredcapabilities when the security
// level of IE not set to same.
ieCapabilities.setBrowserName("SELENIUM");
ieCapabilities.setJavascriptEnabled(true);
ieCapabilities.setCapability("browserstack.ie.enablePopups", "true");
ieCapabilities.setCapability("acceptSslCerts", "true");
// ieCapabilities.setCapability("browserstack.ie.noFlash", "true");
File file = new File(System.getProperty("user.dir") + "//exe//IEDriverServer.exe");
System.setProperty("webdriver.ie.driver", file.getAbsolutePath());
return new InternetExplorerDriver(ieCapabilities);
}
示例4: capabilitiesInternetExplorer
import org.openqa.selenium.ie.InternetExplorerDriver; //导入依赖的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;
}
示例5: initIEDriver
import org.openqa.selenium.ie.InternetExplorerDriver; //导入依赖的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);
}
示例6: getEdgeDriver
import org.openqa.selenium.ie.InternetExplorerDriver; //导入依赖的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);
}
示例7: get32IEDriver
import org.openqa.selenium.ie.InternetExplorerDriver; //导入依赖的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);
}
示例8: get64IEDriver
import org.openqa.selenium.ie.InternetExplorerDriver; //导入依赖的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);
}
示例9: getDefaultDriver
import org.openqa.selenium.ie.InternetExplorerDriver; //导入依赖的package包/类
@Override
public WebDriver getDefaultDriver()
{
String seleniumBrowser = System.getProperty( "selenium.browser" );
if ( StringUtils.contains( seleniumBrowser, "chrome" ) )
{
return new ChromeDriver();
}
if ( StringUtils.contains( seleniumBrowser, "safari" ) )
{
return new SafariDriver();
}
if ( StringUtils.contains( seleniumBrowser, "iexplore" ) )
{
return new InternetExplorerDriver();
}
return new FirefoxDriver();
}
示例10: getDefaultDriver
import org.openqa.selenium.ie.InternetExplorerDriver; //导入依赖的package包/类
@Override
public WebDriver getDefaultDriver()
{
String seleniumBrowser = System.getProperty( "selenium.browser" );
if ( StringUtils.contains( seleniumBrowser, "chrome" ) )
{
return new ChromeDriver();
}
if ( StringUtils.contains( seleniumBrowser, "safari" ) )
{
return new SafariDriver();
}
if ( StringUtils.contains( seleniumBrowser, "iexplore" ) )
{
return new InternetExplorerDriver();
}
return new FirefoxDriver();
}
示例11: start
import org.openqa.selenium.ie.InternetExplorerDriver; //导入依赖的package包/类
WebDriver start(Capabilities capabilities) {
switch (this) {
case FIREFOX:
return new FirefoxDriver(capabilities);
case HTML_UNIT:
return new HtmlUnitDriver(capabilities);
case CHROME:
return new ChromeDriver(capabilities);
case EDGE:
return new EdgeDriver(capabilities);
case INTERNET_EXPLORER:
return new InternetExplorerDriver(capabilities);
case SAFARI:
return new SafariDriver(capabilities);
default:
throw new AssertionError();
}
}
示例12: buildWebDriver
import org.openqa.selenium.ie.InternetExplorerDriver; //导入依赖的package包/类
@Test
public void buildWebDriver() throws Exception {
MockitoAnnotations.initMocks(this);
PowerMockito.whenNew(FirefoxDriver.class).withNoArguments().thenReturn(firefoxDriver);
WebDriver driver = WebDriverFactory.createDriver("firefox");
assertThat(driver).isInstanceOf(FirefoxDriver.class);
PowerMockito.whenNew(InternetExplorerDriver.class).withNoArguments().thenReturn(internetExplorerDriver);
driver = WebDriverFactory.createDriver("ie");
assertThat(driver).isInstanceOf(InternetExplorerDriver.class);
PowerMockito.whenNew(ChromeDriver.class).withNoArguments().thenReturn(chromerDriver);
driver = WebDriverFactory.createDriver("chrome");
assertThat(driver).isInstanceOf(ChromeDriver.class);
PowerMockito.whenNew(RemoteWebDriver.class)
.withArguments(new URL("http://localhost:4444/wd/hub"), DesiredCapabilities.firefox())
.thenReturn(remoteWebDriver);
driver = WebDriverFactory.createDriver("remote:localhost:4444:firefox");
assertThat(driver).isInstanceOf(RemoteWebDriver.class);
}
示例13: initDriver
import org.openqa.selenium.ie.InternetExplorerDriver; //导入依赖的package包/类
private WebDriver initDriver() {
if ("firefox".equals(Config.Browser)) {
driver = new FirefoxDriver();
} else if ("ie".equals(Config.Browser)) {
System.setProperty("webdriver.ie.driver",
"files/IEDriverServer.exe");
driver = new InternetExplorerDriver();
} else if ("chrome".equals(Config.Browser)) {
System.setProperty("webdriver.chrome.driver",
"files/chromedriver.exe");
driver = new ChromeDriver();
// Navigation navigation = driver.navigate();
// navigation.to("https://www.baidu.com");
} else {
System.out.println("浏览器匹配值错误" + Config.Browser);
}
driver.manage().window().maximize();
driver.manage().timeouts()
.pageLoadTimeout(Config.waitTime, TimeUnit.SECONDS);
return driver;
}
示例14: createWebDriver
import org.openqa.selenium.ie.InternetExplorerDriver; //导入依赖的package包/类
@Override
public WebDriver createWebDriver() throws IOException {
// killProcess();
if (!OSUtility.isWindows()) {
throw new RuntimeException("With gods grace IE browser is only supported on windows, Imagine a "
+ "situation when you have to fix IE bugs on Unix and Mac as well");
}
DriverConfig cfg = this.getWebDriverConfig();
driver = new InternetExplorerDriver(new IECapabilitiesFactory().createCapabilities(cfg));
// Implicit Waits to handle dynamic element. The default value is 5 seconds.
setImplicitWaitTimeout(cfg.getImplicitWaitTimeout());
if (cfg.getPageLoadTimeout() >= 0) {
driver.manage().timeouts().pageLoadTimeout(cfg.getPageLoadTimeout(), TimeUnit.SECONDS);
}
this.setWebDriver(driver);
return driver;
}
示例15: Setup
import org.openqa.selenium.ie.InternetExplorerDriver; //导入依赖的package包/类
@BeforeSuite
public void Setup() {
// Uses chrome driver by default
String browser = System.getenv("BROWSER");
if (browser == null) {
browser = DEFAULT;
}
if (browser.toLowerCase().equals(FIREFOX)) {
FirefoxDriverManager.getInstance().setup();
driver = new FirefoxDriver();
} else if (browser.toLowerCase().equals(IE)) {
InternetExplorerDriverManager.getInstance().setup();
driver = new InternetExplorerDriver();
} else {
ChromeDriverManager.getInstance().setup();
driver = new ChromeDriver();
}
}