@@ -185,24 +185,32 @@ public void onloadNull() throws Exception {
185
185
@ Alerts ({"§§URL§§subdir/frame.html" , "§§URL§§frame.html" })
186
186
public void location () throws Exception {
187
187
location ("Frame1.location = \" frame.html\" " );
188
- location ("Frame1.location.replace(\" frame.html\" )" );
188
+ // location("Frame1.location.replace(\"frame.html\")");
189
189
}
190
190
191
191
private void location (final String jsExpr ) throws Exception {
192
192
final String firstContent = DOCTYPE_HTML
193
- + "<html><head><title>first</title></head>\n "
193
+ + "<html><head>\n "
194
+ + "<title>first</title>\n "
195
+ + "</head>\n "
194
196
+ "<frameset cols='*' onload='" + jsExpr + "'>\n "
195
197
+ " <frame name='Frame1' src='subdir/frame.html'>\n "
196
198
+ "</frameset></html>" ;
199
+
197
200
final String defaultContent = DOCTYPE_HTML
198
- + "<html><head><script>alert(location)</script></head></html>" ;
201
+ + "<html><head>\n "
202
+ + "<script>\n "
203
+ + "function log(msg) { window.top.name += msg + '\\ u00a7'; }\n "
204
+ + "log(location);\n "
205
+ + "</script>\n "
206
+ + "</head></html>" ;
199
207
200
208
getMockWebConnection ().setDefaultResponse (defaultContent );
201
209
202
210
final WebDriver driver = loadPage2 (firstContent );
203
211
204
212
expandExpectedAlertsVariables (URL_FIRST );
205
- verifyAlerts (driver , getExpectedAlerts ());
213
+ verifyWindowName2 (driver , getExpectedAlerts ());
206
214
207
215
assertTitle (driver , "first" );
208
216
}
@@ -502,10 +510,15 @@ public void windowLocationReplaceOnload() throws Exception {
502
510
+ "</body></html>" ;
503
511
504
512
final String onloadFrame = DOCTYPE_HTML
505
- + "<html><head><title>onloadFrame</title></head>\n "
506
- + "<body onload=\" alert('Onload alert.');top.header.addToFrameOrder('onloadFrame');\" >\n "
513
+ + "<html><head>\n "
514
+ + "<title>onloadFrame</title>\n "
515
+ + "<script>\n "
516
+ + " function log(msg) { window.top.name += msg + '\\ u00a7'; }\n "
517
+ + "</script>\n "
518
+ + "</head>\n "
519
+ + "<body onload=\" log('Onload alert.');top.header.addToFrameOrder('onloadFrame');\" >\n "
507
520
+ " <script type='text/javascript'>\n "
508
- + " alert ('Body alert.');\n "
521
+ + " log ('Body alert.');\n "
509
522
+ " </script>\n "
510
523
+ " <h3>onloadFrame</h3>\n "
511
524
+ " <p id='newContent'>New content loaded...</p>\n "
@@ -529,8 +542,7 @@ public void windowLocationReplaceOnload() throws Exception {
529
542
assertEquals (getExpectedAlerts ()[2 ], driver .findElement (By .tagName ("body" )).getText ());
530
543
531
544
driver .findElement (By .name ("onloadFrameAnchor" )).click ();
532
- verifyAlerts (driver , "Body alert." );
533
- verifyAlerts (driver , "Onload alert." );
545
+ verifyWindowName2 (driver , "Body alert." , "Onload alert." );
534
546
535
547
driver .switchTo ().defaultContent ();
536
548
Thread .sleep (1000 );
@@ -584,10 +596,15 @@ public void windowLocationAssignOnload() throws Exception {
584
596
+ "</body></html>" ;
585
597
586
598
final String onloadFrame = DOCTYPE_HTML
587
- + "<html><head><title>onloadFrame</title></head>\n "
588
- + "<body onload=\" alert('Onload alert.');top.header.addToFrameOrder('onloadFrame');\" >\n "
599
+ + "<html><head>\n "
600
+ + "<title>onloadFrame</title>\n "
601
+ + "<script>\n "
602
+ + " function log(msg) { window.top.name += msg + '\\ u00a7'; }\n "
603
+ + "</script>\n "
604
+ + "</head>\n "
605
+ + "<body onload=\" log('Onload alert.');top.header.addToFrameOrder('onloadFrame');\" >\n "
589
606
+ " <script type='text/javascript'>\n "
590
- + " alert ('Body alert.');\n "
607
+ + " log ('Body alert.');\n "
591
608
+ " </script>\n "
592
609
+ " <h3>onloadFrame</h3>\n "
593
610
+ " <p id='newContent'>New content loaded...</p>\n "
@@ -611,8 +628,8 @@ public void windowLocationAssignOnload() throws Exception {
611
628
assertEquals (getExpectedAlerts ()[2 ], driver .findElement (By .tagName ("body" )).getText ());
612
629
613
630
driver .findElement (By .name ("onloadFrameAnchor" )).click ();
614
- verifyAlerts (driver , "Body alert." );
615
- verifyAlerts ( driver , "Onload alert." );
631
+ verifyWindowName2 (driver , "Body alert." , "Onload alert." );
632
+
616
633
driver .switchTo ().defaultContent ();
617
634
Thread .sleep (1000 );
618
635
0 commit comments