From d53e5d926638d1c13d43d12fe12951f46b24a978 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sun, 11 Jun 2017 10:45:50 +0200 Subject: [PATCH] Fix for iexplore driver --- .../web/test/tools/WebdriverUtility.java | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/WebdriverUtility.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/WebdriverUtility.java index a1fbca3bf..d48072ddd 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/WebdriverUtility.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/WebdriverUtility.java @@ -96,14 +96,20 @@ public class WebdriverUtility } if (StringUtils.contains(seleniumBrowser, "iexplore")) { + DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer(); + capabilities.setCapability( InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true ); + WebDriver driver; if (seleniumRemote) { - return new RemoteWebDriver( new URL( "http://" + seleniumHost + ":" + seleniumPort + "/wd/hub" ), - DesiredCapabilities.internetExplorer() + driver = new RemoteWebDriver( new URL( "http://" + seleniumHost + ":" + seleniumPort + "/wd/hub" ), + capabilities ); } else { - new InternetExplorerDriver( ); + driver = new InternetExplorerDriver( capabilities ); } + driver.manage().window().maximize(); + return driver; + } if (StringUtils.contains( seleniumBrowser, "firefox" )) @@ -120,18 +126,20 @@ public class WebdriverUtility } } + // Default driver + DesiredCapabilities capabilities = DesiredCapabilities.htmlUnit(); + capabilities.setJavascriptEnabled( true ); + capabilities.setVersion( "firefox-52" ); + WebDriver driver; if ( seleniumRemote ) { - return new RemoteWebDriver( new URL( "http://" + seleniumHost + ":" + seleniumPort + "/wd/hub" ), - DesiredCapabilities.htmlUnit() + driver = new RemoteWebDriver( new URL( "http://" + seleniumHost + ":" + seleniumPort + "/wd/hub" ), + capabilities ); } else { - DesiredCapabilities capabilities = DesiredCapabilities.htmlUnit(); - capabilities.setJavascriptEnabled( true ); - capabilities.setVersion( "firefox-52" ); - HtmlUnitDriver driver = new HtmlUnitDriver( capabilities ) { + driver = new HtmlUnitDriver( capabilities ) { @Override protected WebClient modifyWebClient( WebClient client ) { @@ -141,8 +149,8 @@ public class WebdriverUtility return client; } }; - return driver; } + return driver; } catch (MalformedURLException e) { throw new RuntimeException("Initializion of remote driver failed"); -- 2.39.5