use of org.openqa.selenium.ie.InternetExplorerDriver in project antlr4 by antlr.
the class BaseExplorerTest method initWebDriver.
@Before
public void initWebDriver() {
System.setProperty("webdriver.ie.driver", "C:\\Program Files (x86)\\Selenium\\IEDriverServer.exe");
driver = new InternetExplorerDriver();
}
use of org.openqa.selenium.ie.InternetExplorerDriver in project page-factory-2 by sbtqa.
the class TagWebDriver method createDriver.
private static void createDriver() throws UnsupportedBrowserException, MalformedURLException {
DesiredCapabilities capabilities = new WebDriverCapabilitiesParser().parse();
if (!PROPERTIES.getProxy().isEmpty()) {
Proxy seleniumProxy = ProxyConfigurator.configureProxy();
capabilities.setCapability(CapabilityType.PROXY, seleniumProxy);
}
String browserName = getBrowserName();
capabilities.setBrowserName(browserName);
String webDriverUrl = PROPERTIES.getWebDriverUrl();
if (!webDriverUrl.isEmpty()) {
setWebDriver(createRemoteWebDriver(webDriverUrl, capabilities));
} else {
if (browserName.equalsIgnoreCase(FIREFOX)) {
setWebDriver(new FirefoxDriver(capabilities));
} else if (browserName.equalsIgnoreCase(SAFARI)) {
setWebDriver(new SafariDriver(capabilities));
} else if (browserName.equalsIgnoreCase(CHROME)) {
WebDriverManagerConfigurator.configureDriver(ChromeDriverManager.getInstance(), CHROME);
setWebDriver(new ChromeDriver(capabilities));
} else if (browserName.equalsIgnoreCase(IE)) {
WebDriverManagerConfigurator.configureDriver(InternetExplorerDriverManager.getInstance(), IE);
setWebDriver(new InternetExplorerDriver(capabilities));
} else {
throw new UnsupportedBrowserException("'" + browserName + "' is not supported yet");
}
}
webDriver.manage().timeouts().pageLoadTimeout(PageFactory.getTimeOutInSeconds(), TimeUnit.SECONDS);
setBrowserSize();
webDriver.get(PROPERTIES.getStartingUrl());
}
use of org.openqa.selenium.ie.InternetExplorerDriver in project Payara by payara.
the class SeleniumHelper method getSeleniumInstance.
public SeleniumWrapper getSeleniumInstance() {
if (selenium == null) {
if (Boolean.parseBoolean(SeleniumHelper.getParameter("debug", "false"))) {
logger.log(Level.INFO, "Creating new selenium instance");
}
String browser = getParameter("browser", "firefox");
if ("firefox".equals(browser)) {
driver = new FirefoxDriver();
} else if ("chrome".equals(browser)) {
driver = new ChromeDriver();
} else if ("ie".contains(browser)) {
driver = new InternetExplorerDriver();
}
elementFinder = new ElementFinder(driver);
selenium = new SeleniumWrapper(driver, getBaseUrl());
selenium.setTimeout("90000");
// Make sure the server has started and the user logged in
(new BaseSeleniumTestClass()).openAndWait("/", BaseSeleniumTestClass.TRIGGER_COMMON_TASKS, 480);
}
selenium.windowFocus();
selenium.windowMaximize();
selenium.setTimeout("90000");
return selenium;
}
use of org.openqa.selenium.ie.InternetExplorerDriver in project archiva by apache.
the class WebdriverUtility method newWebDriver.
public static WebDriver newWebDriver(String seleniumBrowser, String seleniumHost, int seleniumPort, boolean seleniumRemote) {
log.info("WebDriver {}, {}, {}, {}", seleniumBrowser, seleniumHost, seleniumPort, seleniumRemote);
if (seleniumRemote && StringUtils.isEmpty(seleniumHost)) {
throw new IllegalArgumentException("seleniumHost must be set, when seleniumRemote=true");
}
try {
if (StringUtils.contains(seleniumBrowser, "chrome")) {
ChromeOptions options = new ChromeOptions();
options.addArguments("start-maximized");
if (seleniumRemote) {
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
return new RemoteWebDriver(new URL("http://" + seleniumHost + ":" + seleniumPort + "/wd/hub"), capabilities);
} else {
return new ChromeDriver(options);
}
}
if (StringUtils.contains(seleniumBrowser, "safari")) {
if (seleniumRemote) {
return new RemoteWebDriver(new URL("http://" + seleniumHost + ":" + seleniumPort + "/wd/hub"), DesiredCapabilities.safari());
} else {
return new SafariDriver();
}
}
if (StringUtils.contains(seleniumBrowser, "iexplore")) {
if (seleniumRemote) {
return new RemoteWebDriver(new URL("http://" + seleniumHost + ":" + seleniumPort + "/wd/hub"), DesiredCapabilities.internetExplorer());
} else {
new InternetExplorerDriver();
}
}
if (StringUtils.contains(seleniumBrowser, "firefox")) {
if (seleniumRemote) {
return new RemoteWebDriver(new URL("http://" + seleniumHost + ":" + seleniumPort + "/wd/hub"), DesiredCapabilities.firefox());
} else {
return new FirefoxDriver();
}
}
DesiredCapabilities capabilities = DesiredCapabilities.htmlUnit();
capabilities.setJavascriptEnabled(true);
capabilities.setVersion("firefox-52");
WebDriver driver;
if (seleniumRemote) {
driver = new RemoteWebDriver(new URL("http://" + seleniumHost + ":" + seleniumPort + "/wd/hub"), capabilities);
} else {
driver = new HtmlUnitDriver(capabilities) {
@Override
protected WebClient modifyWebClient(WebClient client) {
client.getOptions().setThrowExceptionOnFailingStatusCode(false);
client.getOptions().setThrowExceptionOnScriptError(false);
client.getOptions().setCssEnabled(true);
return client;
}
};
}
return driver;
} catch (MalformedURLException e) {
throw new RuntimeException("Initializion of remote driver failed");
}
}
use of org.openqa.selenium.ie.InternetExplorerDriver in project jmeter-plugins by undera.
the class InternetExplorerDriverConfigTest method shouldQuitWebDriverAndStopServiceWhenQuitBrowserIsInvoked.
@Test
public void shouldQuitWebDriverAndStopServiceWhenQuitBrowserIsInvoked() throws Exception {
InternetExplorerDriver mockInternetExplorerDriver = mock(InternetExplorerDriver.class);
InternetExplorerDriverService mockService = mock(InternetExplorerDriverService.class);
when(mockService.isRunning()).thenReturn(true);
config.getServices().put(config.currentThreadName(), mockService);
config.quitBrowser(mockInternetExplorerDriver);
verify(mockInternetExplorerDriver).quit();
assertThat(config.getServices(), is(Collections.<String, InternetExplorerDriverService>emptyMap()));
verify(mockService, times(1)).stop();
}
Aggregations