Skip to content

Commit 2d0aa4f

Browse files
committed
Firefox: changing getCurrentUrl to return top level browsing context address (to conform to the standard)
1 parent 0cd0b26 commit 2d0aa4f

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

java/client/test/org/openqa/selenium/FrameSwitchingTest.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import static org.openqa.selenium.support.ui.ExpectedConditions.titleIs;
3232
import static org.openqa.selenium.testing.Ignore.Driver.ALL;
3333
import static org.openqa.selenium.testing.Ignore.Driver.CHROME;
34-
import static org.openqa.selenium.testing.Ignore.Driver.FIREFOX;
3534
import static org.openqa.selenium.testing.Ignore.Driver.HTMLUNIT;
3635
import static org.openqa.selenium.testing.Ignore.Driver.IE;
3736
import static org.openqa.selenium.testing.Ignore.Driver.MARIONETTE;
@@ -417,7 +416,7 @@ public void testShouldBeAbleToFindElementsInIframesByXPath() {
417416
assertNotNull(element);
418417
}
419418

420-
@Ignore({CHROME, FIREFOX, HTMLUNIT, IE, PHANTOMJS, SAFARI})
419+
@Ignore({CHROME, HTMLUNIT, IE, PHANTOMJS, SAFARI})
421420
@Test
422421
public void testGetCurrentUrlReturnsTopLevelBrowsingContextUrl() {
423422
driver.get(pages.framesetPage);
@@ -427,13 +426,13 @@ public void testGetCurrentUrlReturnsTopLevelBrowsingContextUrl() {
427426
assertThat(driver.getCurrentUrl(), equalTo(pages.framesetPage));
428427
}
429428

430-
@Ignore({CHROME, FIREFOX, HTMLUNIT, IE, PHANTOMJS, SAFARI, MARIONETTE})
429+
@Ignore({CHROME, HTMLUNIT, IE, PHANTOMJS, SAFARI, MARIONETTE})
431430
@Test
432431
public void testGetCurrentUrlReturnsTopLevelBrowsingContextUrlForIframes() {
433432
driver.get(pages.iframePage);
434433
assertThat(driver.getCurrentUrl(), equalTo(pages.iframePage));
435434

436-
driver.switchTo().frame("second");
435+
driver.switchTo().frame("iframe1");
437436
assertThat(driver.getCurrentUrl(), equalTo(pages.iframePage));
438437
}
439438

javascript/firefox-driver/js/firefoxDriver.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,7 @@ FirefoxDriver.prototype.getCurrentWindowHandle = function(respond) {
9898

9999

100100
FirefoxDriver.prototype.getCurrentUrl = function(respond) {
101-
var window = respond.session.getWindow();
102-
var url;
103-
if (window) {
104-
url = window.location;
105-
}
106-
if (!url) {
107-
url = respond.session.getBrowser().contentWindow.location;
108-
}
109-
respond.value = '' + url;
101+
respond.value = '' + respond.session.getBrowser().contentWindow.location;
110102
respond.send();
111103
};
112104

0 commit comments

Comments
 (0)