本文整理汇总了Java中org.openqa.selenium.ie.InternetExplorerDriverService类的典型用法代码示例。如果您正苦于以下问题:Java InternetExplorerDriverService类的具体用法?Java InternetExplorerDriverService怎么用?Java InternetExplorerDriverService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InternetExplorerDriverService类属于org.openqa.selenium.ie包,在下文中一共展示了InternetExplorerDriverService类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureBrowser
import org.openqa.selenium.ie.InternetExplorerDriverService; //导入依赖的package包/类
@Subscribe
public void configureBrowser(final BeforeWebDriverCreationEvent event) {
switch (browser) {
case "firefox": {
// configure Firefox
}
case "chrome": {
setPathToDriverIfExistsAndIsExecutable(relativePathToChromeDriver, ChromeDriverService.CHROME_DRIVER_EXE_PROPERTY);
// configure Chrome
break;
}
case "ie": {
setPathToDriverIfExistsAndIsExecutable(relativePathToIeDriver, InternetExplorerDriverService.IE_DRIVER_EXE_PROPERTY);
// configure InternetExplorer
break;
}
default: {
throw new RuntimeException(String.format("Please configure one of the supported browsers in %s", JFunkConstants.SCRIPT_PROPERTIES));
}
}
}
示例2: InternetExplorer
import org.openqa.selenium.ie.InternetExplorerDriverService; //导入依赖的package包/类
/**
* 本地初始化IE浏览器driver
*/
public InternetExplorer() {
System.setProperty("webdriver.ie.driver", System.getProperty("user.dir") + Constants.IE_PATH);
InternetExplorerDriverService service = (InternetExplorerDriverService) ((InternetExplorerDriverService.Builder) new InternetExplorerDriverService.Builder()
.usingAnyFreePort()).build();
DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);// 关闭保护模式,IE默认为开启模式
capabilities.setCapability("unexpectedAlertBehaviour", "accept");
this.driver = new InternetExplorerDriver(service, capabilities);
}
示例3: getIeConfigurado
import org.openqa.selenium.ie.InternetExplorerDriverService; //导入依赖的package包/类
private WebDriver getIeConfigurado(String proxy) {
org.openqa.selenium.Proxy proxyy = new org.openqa.selenium.Proxy();
proxyy.setHttpProxy(proxy);
proxyy.setFtpProxy(proxy);
proxyy.setSslProxy(proxy);
proxyy.setAutodetect(false);
DesiredCapabilities capabilities = DesiredCapabilities
.internetExplorer();
capabilities
.setCapability(
InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,
false);
capabilities.setCapability(CapabilityType.PROXY, proxyy);
capabilities.setBrowserName("ie");
ieService = new InternetExplorerDriverService.Builder()
.usingDriverExecutable(new File(InterNavegador.PATH_IEX))
.usingAnyFreePort().build();
try {
ieService.start();
} catch (IOException e) {
System.out.println(e);
}
return new RemoteWebDriver(ieService.getUrl(), capabilities);
// return new InternetExplorerDriver(capabilities);
}
示例4: createDriverService
import org.openqa.selenium.ie.InternetExplorerDriverService; //导入依赖的package包/类
@Override
public DriverService createDriverService() {
Builder builder = new InternetExplorerDriverService.Builder();
if (port != null) builder.usingPort(port);
if (driverExecutable != null) builder.usingDriverExecutable(driverExecutable);
if (environment != null) builder.withEnvironment(environment);
if (logFile != null) builder.withLogFile(logFile);
if (logLevel != null) builder.withLogLevel(InternetExplorerDriverLogLevel.valueOf(logLevel.toUpperCase()));
if (engineImplementation != null) builder.withEngineImplementation(InternetExplorerDriverEngine.valueOf(engineImplementation.toUpperCase()));
if (host != null) builder.withHost(host);
if (extractPath != null) builder.withExtractPath(extractPath);
if (silent != null) builder.withSilent(silent);
return builder.build();
}
示例5: getPathProperty
import org.openqa.selenium.ie.InternetExplorerDriverService; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public String getPathProperty() {
return InternetExplorerDriverService.IE_DRIVER_EXE_PROPERTY;
}
示例6: InternetExplorerDriver
import org.openqa.selenium.ie.InternetExplorerDriverService; //导入依赖的package包/类
public InternetExplorerDriver(InternetExplorerDriverService service) {
super(new org.openqa.selenium.ie.InternetExplorerDriver(service));
}
示例7: createWebDriver
import org.openqa.selenium.ie.InternetExplorerDriverService; //导入依赖的package包/类
/**
*
* @return the webdriver
* @throws IOException if there is a problem loading the
* properties file
*/
private WebDriver createWebDriver() throws IOException {
Resource propertiesFile = new ClassPathResource(
"META-INF/spring/application.properties");
Properties properties = new Properties();
properties.load(propertiesFile.getInputStream());
String webdriverMode = properties.getProperty("selenium.webdriver.mode", "local");
String driverName = properties.getProperty("selenium.webdriver.impl", "org.openqa.selenium.firefox.FirefoxDriver");
WebDriverBrowserType browser = WebDriverBrowserType.fromString(driverName);
String display = properties.getProperty("selenium.display.port", ":0");
if (webdriverMode.equals("local")) {
switch (browser) {
case CHROME:
String chromeLocation = properties
.getProperty("selenium.webdriver.chromedriver.location");
Map<String,String> environment = new HashMap<String,String>();
environment.put("DISPLAY", display);
ChromeDriverService chromeService = new ChromeDriverService.Builder()
.usingDriverExecutable(new File(chromeLocation))
.usingAnyFreePort().withEnvironment(environment).build();
chromeService.start();
return new RemoteWebDriver(chromeService.getUrl(),
DesiredCapabilities.chrome());
case SAFARI:
return new SafariDriver();
case INTERNET_EXPLORER:
String internetExplorerLocation = properties
.getProperty("selenium.webdriver.ie.location");
InternetExplorerDriverService ieService = InternetExplorerDriverService.createDefaultService();
ieService.start();
return new RemoteWebDriver(ieService.getUrl(),
DesiredCapabilities.internetExplorer());
case FIREFOX:
default:
FirefoxBinary firefoxBinary = new FirefoxBinary();
firefoxBinary.setEnvironmentProperty("DISPLAY", display);
ProfilesIni allProfiles = new ProfilesIni();
FirefoxProfile profile = allProfiles.getProfile("default");
return new FirefoxDriver(firefoxBinary, profile);
}
} else {
DesiredCapabilities capabilities = new DesiredCapabilities();
switch (browser) {
case CHROME:
capabilities = DesiredCapabilities.chrome();
break;
case INTERNET_EXPLORER:
capabilities = DesiredCapabilities.internetExplorer();
break;
case SAFARI:
capabilities = DesiredCapabilities.safari();
break;
case FIREFOX:
default:
capabilities = DesiredCapabilities.firefox();
}
String platformName = properties.getProperty("selenium.webdriver.platformName", "LINUX");
WebDriverPlatformType platform = WebDriverPlatformType.valueOf(platformName);
switch (platform) {
case MAC:
capabilities.setPlatform(Platform.MAC);
break;
case WINDOWS:
capabilities.setPlatform(Platform.WINDOWS);
break;
case LINUX:
default:
capabilities.setPlatform(Platform.LINUX);
}
return new RemoteWebDriver(new URL("http://build.e-monocot.org:4444/wd/hub"), capabilities);
}
}
示例8: createBrowser
import org.openqa.selenium.ie.InternetExplorerDriverService; //导入依赖的package包/类
public Browser createBrowser(int port) {
InternetExplorerDriverService service = InternetExplorerDriverService.createDefaultService();
DesiredCapabilities capabilities = getDefaultCapabilities();
return createBrowser(new InternetExplorerDriver(service, capabilities, port));
}
示例9: usingService
import org.openqa.selenium.ie.InternetExplorerDriverService; //导入依赖的package包/类
public InternetExplorerBrowserFactory usingService(InternetExplorerDriverService ieds) {
service = ieds;
return this;
}