Skip to content

Commit

Permalink
IE is gone
Browse files Browse the repository at this point in the history
  • Loading branch information
rbri committed Apr 2, 2024
1 parent 8f1bd7d commit acd31a9
Show file tree
Hide file tree
Showing 21 changed files with 27 additions and 196 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,10 @@ public static BrowserVersion determine(final Capabilities capabilities) {
if (browserName.equalsIgnoreCase(BrowserVersion.CHROME.getNickname())
|| "googlechrome".equalsIgnoreCase(browserName)) {
browserVersionObject = BrowserVersion.CHROME;

}
else if (browserName.equalsIgnoreCase(BrowserVersion.EDGE.getNickname())
|| "MicrosoftEdge".equalsIgnoreCase(browserName)) {
browserVersionObject = BrowserVersion.EDGE;

}
else if (browserName.equalsIgnoreCase(BrowserVersion.INTERNET_EXPLORER.getNickname())
|| "internet explorer".equalsIgnoreCase(browserName)) {
browserVersionObject = BrowserVersion.INTERNET_EXPLORER;

}
else if (browserName.equalsIgnoreCase(BrowserVersion.FIREFOX.getNickname())
|| "firefox".equalsIgnoreCase(browserName)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,7 @@ public String getText() {
throw new NoAlertPresentException();
}
String msg = holder_.message_;
msg = msg.replace("\r\n", "\n");
if (!driver_.getBrowserVersion().isIE()) {
msg = msg.replace('\r', '\n');
}
msg = msg.replace("\r\n", "\n").replace('\r', '\n');
return msg;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,7 @@ public HtmlUnitDriver(final BrowserVersion version, final boolean enableJavascri
/**
* The browserName is {@link Browser#HTMLUNIT} "htmlunit" and the
* browserVersion denotes the required browser AND its version. For example
* "chrome" for Chrome, "firefox-100" for Firefox 100 or "internet explorer" for
* IE.
* "chrome" for Chrome, "firefox-100" for Firefox 100.
*
* @param capabilities desired capabilities requested for the htmlunit driver
* session
Expand Down
13 changes: 3 additions & 10 deletions src/test/java/org/openqa/selenium/htmlunit/HtmlUnitAlertTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,7 @@ public void alertWithLineBreak() throws Exception {
driver.findElement(By.id("clickMe")).click();

// selenium seems to normalize this
if (getBrowserVersion().isIE()) {
assertEquals("1\n2\n3\t4\r5\n\r6", driver.switchTo().alert().getText());
}
else {
assertEquals("1\n2\n3\t4\n5\n\n6", driver.switchTo().alert().getText());
}
assertEquals("1\n2\n3\t4\n5\n\n6", driver.switchTo().alert().getText());
driver.switchTo().alert().dismiss();
}

Expand Down Expand Up @@ -226,8 +221,7 @@ public void testSettingTheValueOfAnAlertThrows() throws Exception {
@Alerts("Unexpected alert found: HtmlUnit is great")
@BuggyWebDriver(DEFAULT = "unexpected alert open: {Alert text : HtmlUnit is great}",
FF = "Dismissed user prompt dialog: HtmlUnit is great",
FF_ESR = "Dismissed user prompt dialog: HtmlUnit is great",
IE = "Modal dialog present with text: HtmlUnit is great")
FF_ESR = "Dismissed user prompt dialog: HtmlUnit is great")
public void testIncludesAlertTextInUnhandledAlertException() throws Exception {
final String html = "<html>\n"
+ "<head>\n"
Expand Down Expand Up @@ -256,8 +250,7 @@ public void testIncludesAlertTextInUnhandledAlertException() throws Exception {
@Alerts("Unexpected alert found: HtmlUnit is great")
@BuggyWebDriver(DEFAULT = "unexpected alert open: {Alert text : HtmlUnit is great}",
FF = "Dismissed user prompt dialog: HtmlUnit is great",
FF_ESR = "Dismissed user prompt dialog: HtmlUnit is great",
IE = "Modal dialog present with text: HtmlUnit is great")
FF_ESR = "Dismissed user prompt dialog: HtmlUnit is great")
@NotYetImplemented
public void testIncludesAlertTextInUnhandledAlertExceptionFromnAsyncScript() throws Exception {
final String html = "<html>\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import static org.htmlunit.BrowserVersion.FIREFOX;
import static org.htmlunit.BrowserVersion.FIREFOX_ESR;
import static org.htmlunit.BrowserVersion.INTERNET_EXPLORER;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
Expand Down Expand Up @@ -48,15 +47,16 @@ public class HtmlUnitCapabilitiesTest {

@Test
public void configurationViaDirectCapabilities() {
final DesiredCapabilities ieCapabilities = new DesiredCapabilities(Browser.IE.browserName(), "", Platform.ANY);
final DesiredCapabilities capabilities =
new DesiredCapabilities(Browser.CHROME.browserName(), "", Platform.ANY);

try {
BrowserVersionDeterminer.determine(ieCapabilities);
BrowserVersionDeterminer.determine(capabilities);
fail("IllegalArgumentException expected");
}
catch (final IllegalArgumentException e) {
assertEquals("When building an HtmlUntDriver, the capability browser name "
+ "must be set to 'htmlunit' but was 'internet explorer'.", e.getMessage());
+ "must be set to 'htmlunit' but was 'chrome'.", e.getMessage());
}
}

Expand Down Expand Up @@ -108,13 +108,6 @@ public void configurationOfFirefoxEsrViaRemote() {
assertEquals(FIREFOX_ESR, BrowserVersionDeterminer.determine(firefoxCapabilities));
}

@Test
public void configurationOfIEViaRemote() {
final DesiredCapabilities ieCapabilities = new DesiredCapabilities(Browser.HTMLUNIT.browserName(),
"internet explorer", Platform.ANY);
assertEquals(INTERNET_EXPLORER, BrowserVersionDeterminer.determine(ieCapabilities));
}

@Test
public void tetsDefautlBrowserVersion() {
final DesiredCapabilities capabilities =
Expand Down
18 changes: 0 additions & 18 deletions src/test/java/org/openqa/selenium/htmlunit/HtmlUnitDriverTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,24 +188,6 @@ protected WebClient modifyWebClient(final WebClient client) {
};
}

@Test
public void ctorWebClientBrowserVersionIE() {
new HtmlUnitDriver(BrowserVersion.INTERNET_EXPLORER) {
@Override
protected WebClient modifyWebClient(final WebClient client) {

assertEquals(BrowserVersion.INTERNET_EXPLORER, client.getBrowserVersion());

assertFalse("client.getOptions().isJavaScriptEnabled() is true",
client.getOptions().isJavaScriptEnabled());
assertFalse("client.isJavaScriptEnabled() is true", client.isJavaScriptEnabled());
assertTrue("client.isJavaScriptEngineEnabled() is false", client.isJavaScriptEngineEnabled());

return client;
}
};
}

@Test
public void ctorWebClientBrowserVersionFirefoxJsFalse() {
new HtmlUnitDriver(BrowserVersion.FIREFOX, false) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ public void domAttribute() throws Exception {
FF = "",
FF_ESR = "")
@HtmlUnitNYI(CHROME = "",
EDGE = "",
IE = "")
EDGE = "")
public void unsupportedAttribute() throws Exception {
final String html = "<html>\n"
+ "<head>\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ public void domProperty() throws Exception {
}

@Test
@Alerts(DEFAULT = "null",
IE = "true")
@Alerts("null")
public void unsupportedAttribute() throws Exception {
final String html = "<html>\n"
+ "<head>\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,9 @@ public class HtmlUnitWebElementTextTest extends WebDriverTestCase {
@Alerts(CHROME = " option1\n Number Three\n Number 4\n ",
EDGE = " option1\n Number Three\n Number 4\n ",
FF = "option1\nNumber Three\nNumber 4",
FF_ESR = "option1\nNumber Three\nNumber 4",
IE = "option1 Number Three Number 4")
FF_ESR = "option1\nNumber Three\nNumber 4")
@HtmlUnitNYI(CHROME = "option1\nNumber Three\nNumber 4",
EDGE = "option1\nNumber Three\nNumber 4",
IE = "option1\nNumber Three\nNumber 4")
EDGE = "option1\nNumber Three\nNumber 4")
public void select() throws Exception {
final String html =
"<html>\n"
Expand Down
43 changes: 3 additions & 40 deletions src/test/java/org/openqa/selenium/htmlunit/WebDriverTestCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import static java.nio.charset.StandardCharsets.ISO_8859_1;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.htmlunit.BrowserVersion.INTERNET_EXPLORER;
import static org.junit.Assert.fail;

import java.io.File;
Expand Down Expand Up @@ -108,9 +107,6 @@
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.firefox.GeckoDriverService;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.ie.InternetExplorerDriverService;
import org.openqa.selenium.ie.InternetExplorerOptions;
import org.openqa.selenium.remote.Browser;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.UnreachableBrowserException;
Expand All @@ -125,7 +121,6 @@
browsers=hu,ff,ie
chrome.bin=/path/to/chromedriver [Unix-like]
ff-esr.bin=/usr/bin/firefox [Unix-like]
ie.bin=C:\\path\\to\\32bit\\IEDriverServer.exe [Windows]
edge.bin=C:\\path\\to\\msedgedriver.exe [Windows]
</pre>
* The file could contain some properties:
Expand Down Expand Up @@ -208,8 +203,7 @@ public abstract class WebDriverTestCase extends WebTestCase {
Arrays.asList(BrowserVersion.CHROME,
BrowserVersion.EDGE,
BrowserVersion.FIREFOX,
BrowserVersion.FIREFOX_ESR,
BrowserVersion.INTERNET_EXPLORER));
BrowserVersion.FIREFOX_ESR));

/**
* Browsers which run by default.
Expand All @@ -218,14 +212,12 @@ public abstract class WebDriverTestCase extends WebTestCase {
{BrowserVersion.CHROME,
BrowserVersion.EDGE,
BrowserVersion.FIREFOX,
BrowserVersion.FIREFOX_ESR,
BrowserVersion.INTERNET_EXPLORER};
BrowserVersion.FIREFOX_ESR};

private static final Log LOG = LogFactory.getLog(WebDriverTestCase.class);

private static Set<String> BROWSERS_PROPERTIES_;
private static String CHROME_BIN_;
private static String IE_BIN_;
private static String EDGE_BIN_;
private static String GECKO_BIN_;
private static String FF_BIN_;
Expand Down Expand Up @@ -283,7 +275,6 @@ public static Set<String> getBrowsersProperties() {
BROWSERS_PROPERTIES_ = new HashSet<>(Arrays.asList(browsersValue.replaceAll(" ", "")
.toLowerCase(Locale.ROOT).split(",")));
CHROME_BIN_ = properties.getProperty("chrome.bin");
IE_BIN_ = properties.getProperty("ie.bin");
EDGE_BIN_ = properties.getProperty("edge.bin");

GECKO_BIN_ = properties.getProperty("geckodriver.bin");
Expand Down Expand Up @@ -438,13 +429,6 @@ private static void quit(final WebDriver driver) {
}
}

/**
* Closes the real IE browser drivers.
*/
protected static void shutDownRealIE() {
shutDownReal(INTERNET_EXPLORER);
}

/**
* Asserts all static servers are null.
* @throws Exception if it fails
Expand Down Expand Up @@ -510,20 +494,6 @@ public void setUseStandards(final boolean useStandards) {
*/
protected WebDriver buildWebDriver() throws IOException {
if (useRealBrowser()) {
if (BrowserVersion.INTERNET_EXPLORER == getBrowserVersion()) {
if (IE_BIN_ != null) {
System.setProperty(InternetExplorerDriverService.IE_DRIVER_EXE_PROPERTY, IE_BIN_);
}

final InternetExplorerOptions options = new InternetExplorerOptions();
options.ignoreZoomSettings();

// clear the cookies - seems to be not done by the driver
final InternetExplorerDriver ieDriver = new InternetExplorerDriver(options);
ieDriver.manage().deleteAllCookies();
return ieDriver;
}

if (BrowserVersion.EDGE == getBrowserVersion()) {
if (EDGE_BIN_ != null) {
final EdgeDriverService service = new EdgeDriverService.Builder()
Expand Down Expand Up @@ -1038,7 +1008,7 @@ protected final WebDriver loadPage2(final String html, final URL url,
protected void resizeIfNeeded(final WebDriver driver) {
final Dimension size = driver.manage().window().getSize();
if (size.getWidth() != 1272 || size.getHeight() != 768) {
// only resize if needed because it may be quite expensive (e.g. IE)
// only resize if needed because it may be quite expensive
driver.manage().window().setSize(new Dimension(1272, 768));
}
}
Expand Down Expand Up @@ -1389,13 +1359,6 @@ protected List<String> getCollectedAlerts(final long maxWaitTime, final WebDrive
// handling of alerts requires some time
// at least for tests with many alerts we have to take this into account
maxWait += 100;

if (useRealBrowser()) {
if (getBrowserVersion().isIE()) {
// alerts for real IE are really slow
maxWait += 5000;
}
}
}
catch (final NoAlertPresentException e) {
Thread.sleep(10);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public void relativeElementsByClassName() throws Exception {

@Test
@Alerts("testId")
@HtmlUnitNYI(CHROME = "", EDGE = "", FF = "", FF_ESR = "", IE = "")
@HtmlUnitNYI(CHROME = "", EDGE = "", FF = "", FF_ESR = "")
public void caseInsensitiveByClassName() throws Exception {
final String html = "<html>\n"
+ "<head>\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ public class HTMLImageElementTest extends WebDriverTestCase {
@Test
@Alerts(DEFAULT = {"number: 300", "number: 200", "number: 24", "number: 24", "number: 24", "number: 24"},
CHROME = {"number: 300", "number: 200", "number: 16", "number: 16", "number: 16", "number: 16"},
EDGE = {"number: 300", "number: 200", "number: 16", "number: 16", "number: 16", "number: 16"},
IE = {"number: 300", "number: 200", "number: 28", "number: 30", "number: 28", "number: 30"})
EDGE = {"number: 300", "number: 200", "number: 16", "number: 16", "number: 16", "number: 16"})
public void widthHeightInvalidSource() throws Exception {
getMockWebConnection().setDefaultResponse("");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ public void newWindowFromLinkWithTarget() throws Exception {
* @throws Exception if something goes wrong
*/
@Test
// shift click seems not working with real IE
public void newWindowFromShiftClick() throws Exception {
final String html =
"<html>\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ public class LocationContextTest extends WebDriverTestCase {
@Test
@Alerts(DEFAULT = "LocationContext supported",
FF = "LocationContext not supported",
FF_ESR = "LocationContext not supported",
IE = "LocationContext not supported")
FF_ESR = "LocationContext not supported")
@HtmlUnitNYI(CHROME = "LocationContext not supported",
EDGE = "LocationContext not supported")
public void locationContext() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
public class WebStorageTest extends WebDriverTestCase {

@Test
@Alerts(DEFAULT = "WebStorage supported",
IE = "WebStorage not supported")
@Alerts("WebStorage supported")
@HtmlUnitNYI(CHROME = "WebStorage not supported",
EDGE = "WebStorage not supported",
FF = "WebStorage not supported",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,7 @@ public void ctrlClick() throws Exception {
FF = {"[object Event]", "undefined", "[object MouseEvent]", "1",
"[object MouseEvent]", "2", "[object MouseEvent]", "1"},
FF_ESR = {"[object Event]", "undefined", "[object MouseEvent]", "1",
"[object MouseEvent]", "2", "[object MouseEvent]", "2"},
IE = {"[object Event]", "undefined", "[object PointerEvent]", "0",
"[object PointerEvent]", "0", "[object PointerEvent]", "0"})
"[object MouseEvent]", "2", "[object MouseEvent]", "2"})
public void detail() throws Exception {
final String html =
"<html><head><script>\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ public void mouseOver() throws Exception {
* @throws Exception if an error occurs
*/
@Test
@Alerts(DEFAULT = "Test:mouse over [disabledBtn]",
IE = "Test:")
@Alerts("Test:mouse over [disabledBtn]")
public void mouseOverDiabled() throws Exception {
final String html =
STANDARDS_MODE_PREFIX_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,6 @@ public BrowserParameterizedRunner(final Class<WebTestCase> klass) throws Throwab
runners_.add(new BrowserVersionClassRunnerWithParameters(
klass, BrowserVersion.FIREFOX, true, tests));
}
if (browsers.contains(BrowserRunner.REAL_IE)) {
runners_.add(new BrowserVersionClassRunnerWithParameters(
klass, BrowserVersion.INTERNET_EXPLORER, true, tests));
}
if (browsers.contains(BrowserRunner.REAL_EDGE)) {
runners_.add(new BrowserVersionClassRunnerWithParameters(
klass, BrowserVersion.EDGE, true, tests));
Expand All @@ -166,10 +162,6 @@ public BrowserParameterizedRunner(final Class<WebTestCase> klass) throws Throwab
runners_.add(new BrowserVersionClassRunnerWithParameters(
klass, BrowserVersion.FIREFOX, false, tests));
}
if (browsers.contains(BrowserRunner.HTMLUNIT_IE)) {
runners_.add(new BrowserVersionClassRunnerWithParameters(
klass, BrowserVersion.INTERNET_EXPLORER, false, tests));
}
if (browsers.contains(BrowserRunner.HTMLUNIT_EDGE)) {
runners_.add(new BrowserVersionClassRunnerWithParameters(
klass, BrowserVersion.EDGE, false, tests));
Expand Down
Loading

0 comments on commit acd31a9

Please sign in to comment.