Skip to content

Commit 3c4bb0e

Browse files
committed
remove alerts() calls
1 parent 96c054d commit 3c4bb0e

2 files changed

Lines changed: 17 additions & 9 deletions

File tree

src/test/java/org/htmlunit/general/ElementClosesItselfTest.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,26 @@ public class ElementClosesItselfTest extends WebDriverTestCase {
3030

3131
private void test(final String tagName) throws Exception {
3232
if ("basefont".equals(tagName) || "isindex".equals(tagName)) {
33-
loadPageWithAlerts2(headElementClosesItself(tagName));
33+
loadPage2(headElementClosesItself(tagName));
34+
verifyWindowName2(getWebDriver(), getExpectedAlerts());
3435
return;
3536
}
3637

3738
if ("title".equals(tagName)) {
3839
// title is a bit special, we have to provide at least
3940
// one closing tab otherwise title spans to the end of the file
40-
loadPageWithAlerts2(DOCTYPE_HTML + "<html><head>\n"
41+
loadPage2(DOCTYPE_HTML + "<html><head>\n"
4142
+ "<script>\n"
43+
+ LOG_WINDOW_NAME_FUNCTION
4244
+ "function test() {\n"
4345
+ " var e = document.getElementById('outer');\n"
44-
+ " alert(e == null ? e : e.children.length);\n"
46+
+ " log(e == null ? e : e.children.length);\n"
4547
+ "}\n"
4648
+ "</script>\n"
4749
+ "<title id='outer'><title></title>\n"
4850
+ "</head><body onload='test()'>\n"
4951
+ "</body></html>");
52+
verifyWindowName2(getWebDriver(), getExpectedAlerts());
5053
return;
5154
}
5255

@@ -84,18 +87,20 @@ private void test(final String tagName) throws Exception {
8487
}
8588

8689
if ("frameset".equals(tagName)) {
87-
loadPageWithAlerts2(DOCTYPE_HTML
90+
loadPage2(DOCTYPE_HTML
8891
+ "<html><head>\n"
8992
+ "<script>\n"
93+
+ LOG_WINDOW_NAME_FUNCTION
9094
+ "function test() {\n"
9195
+ " var e = document.getElementById('outer');\n"
92-
+ " alert(e == null ? e : e.children.length);\n"
96+
+ " log(e == null ? e : e.children.length);\n"
9397
+ "}\n"
9498
+ "</script>\n"
9599
+ "</head>\n"
96100
+ "<frameset onload='test()' id='outer'>\n"
97101
+ "<frameset>\n"
98102
+ "</frameset></html>");
103+
verifyWindowName2(getWebDriver(), getExpectedAlerts());
99104
return;
100105
}
101106

@@ -120,9 +125,10 @@ private static String headElementClosesItself(final String tagName) {
120125
+ "<html><head>\n"
121126
+ "<" + tagName + " id='outer'><" + tagName + ">\n"
122127
+ "<script>\n"
128+
+ LOG_WINDOW_NAME_FUNCTION
123129
+ "function test() {\n"
124130
+ " var e = document.getElementById('outer');\n"
125-
+ " alert(e == null ? e : e.children.length);\n"
131+
+ " log(e == null ? e : e.children.length);\n"
126132
+ "}\n"
127133
+ "</script>\n"
128134
+ "</head><body onload='test()'>\n"

src/test/java/org/htmlunit/general/ElementCreationTest.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,17 @@ public class ElementCreationTest extends WebDriverTestCase {
2929
private void test(final String tagName) throws Exception {
3030
final String html = DOCTYPE_HTML
3131
+ "<html><head><script>\n"
32+
+ LOG_WINDOW_NAME_FUNCTION
3233
+ " function test() {\n"
3334
+ " try {\n"
34-
+ " alert(document.createElement('" + tagName + "'));\n"
35-
+ " } catch(e) {alert('exception')}\n"
35+
+ " log(document.createElement('" + tagName + "'));\n"
36+
+ " } catch(e) {log('exception')}\n"
3637
+ " }\n"
3738
+ "</script></head><body onload='test()'>\n"
3839
+ "</body></html>";
3940

40-
loadPageWithAlerts2(html);
41+
loadPage2(html);
42+
verifyWindowName2(getWebDriver(), getExpectedAlerts());
4143
}
4244

4345
/**

0 commit comments

Comments
 (0)