31
31
import static org .openqa .selenium .support .ui .ExpectedConditions .titleIs ;
32
32
import static org .openqa .selenium .testing .Ignore .Driver .ALL ;
33
33
import static org .openqa .selenium .testing .Ignore .Driver .CHROME ;
34
+ import static org .openqa .selenium .testing .Ignore .Driver .FIREFOX ;
35
+ import static org .openqa .selenium .testing .Ignore .Driver .HTMLUNIT ;
34
36
import static org .openqa .selenium .testing .Ignore .Driver .IE ;
35
37
import static org .openqa .selenium .testing .Ignore .Driver .MARIONETTE ;
36
38
import static org .openqa .selenium .testing .Ignore .Driver .PHANTOMJS ;
@@ -412,23 +414,24 @@ public void testShouldBeAbleToFindElementsInIframesByXPath() {
412
414
assertNotNull (element );
413
415
}
414
416
415
- @ Ignore ({MARIONETTE })
417
+ @ Ignore ({CHROME , FIREFOX , HTMLUNIT , IE , PHANTOMJS , SAFARI })
416
418
@ Test
417
- public void testGetCurrentUrl () {
419
+ public void testGetCurrentUrlReturnsTopLevelBrowsingContextUrl () {
418
420
driver .get (pages .framesetPage );
421
+ assertThat (driver .getCurrentUrl (), equalTo (pages .framesetPage ));
419
422
420
423
driver .switchTo ().frame ("second" );
424
+ assertThat (driver .getCurrentUrl (), equalTo (pages .framesetPage ));
425
+ }
421
426
422
- String url = appServer .whereIs ("page/2" );
423
- assertThat (driver .getCurrentUrl (), equalTo (url + "?title=Fish" ));
424
-
425
- url = appServer .whereIs ("iframes.html" );
427
+ @ Ignore ({CHROME , FIREFOX , HTMLUNIT , IE , PHANTOMJS , SAFARI })
428
+ @ Test
429
+ public void testGetCurrentUrlReturnsTopLevelBrowsingContextUrlForIframes () {
426
430
driver .get (pages .iframePage );
427
- assertThat (driver .getCurrentUrl (), equalTo (url ));
431
+ assertThat (driver .getCurrentUrl (), equalTo (pages . iframePage ));
428
432
429
- url = appServer .whereIs ("formPage.html" );
430
- driver .switchTo ().frame ("iframe1" );
431
- assertThat (driver .getCurrentUrl (), equalTo (url ));
433
+ driver .switchTo ().frame ("second" );
434
+ assertThat (driver .getCurrentUrl (), equalTo (pages .iframePage ));
432
435
}
433
436
434
437
@ Ignore (value = {PHANTOMJS })
@@ -544,7 +547,6 @@ public void testJavaScriptShouldExecuteInTheContextOfTheCurrentFrame() {
544
547
assertTrue ((Boolean ) executor .executeScript ("return window != window.top" ));
545
548
}
546
549
547
- @ Ignore (MARIONETTE )
548
550
@ Test
549
551
public void testShouldNotSwitchMagicallyToTheTopWindow () {
550
552
String baseUrl = appServer .whereIs ("frame_switching_tests/" );
@@ -560,7 +562,7 @@ public void testShouldNotSwitchMagicallyToTheTopWindow() {
560
562
input .sendKeys ("rand" + new Random ().nextInt ());
561
563
submit .click ();
562
564
} finally {
563
- String url = driver . getCurrentUrl ( );
565
+ String url = ( String ) (( JavascriptExecutor ) driver ). executeScript ( "return window.location.href" );
564
566
// IE6 and Chrome add "?"-symbol to the end of the URL
565
567
if (url .endsWith ("?" )) {
566
568
url = url .substring (0 , url .length ()-1 );
0 commit comments