Skip to content

Commit

Permalink
Fixing eager page load strategy in Firefox on page refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
barancev committed Apr 20, 2015
1 parent eff8b88 commit b14d428
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions common/src/web/slowLoadingResourcePage.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
too long to respond. Normally these things are loaded in an iframe, which is
what we're doing here.</p>

<img src="sleep?time=6"></img>
<img src="sleep?time=7"></img>
</body>
</html>
</html>
10 changes: 5 additions & 5 deletions java/client/test/org/openqa/selenium/PageLoadingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public void testEagerStrategyShouldNotWaitForResources() {
localDriver.get(slowPage);
// We discard the element, but want a check to make sure the GET actually
// completed.
localDriver.findElement(By.id("peas"));
new WebDriverWait(localDriver, 10).until(presenceOfElementLocated(By.id("peas")));
long end = System.currentTimeMillis();

// The slow loading resource on that page takes 6 seconds to return. If we
Expand All @@ -140,7 +140,7 @@ public void testEagerStrategyShouldNotWaitForResources() {
assertTrue("Took too long to load page: " + duration, duration < 5 * 1000);
}

@Ignore(value = {FIREFOX, IE, CHROME, SAFARI, MARIONETTE, PHANTOMJS, HTMLUNIT})
@Ignore(value = {IE, CHROME, SAFARI, MARIONETTE, PHANTOMJS, HTMLUNIT})
@NeedsLocalEnvironment
@Test
public void testEagerStrategyShouldNotWaitForResourcesOnRefresh() {
Expand All @@ -150,12 +150,12 @@ public void testEagerStrategyShouldNotWaitForResourcesOnRefresh() {

localDriver.get(slowPage);
// We discard the element, but want a check to make sure the GET actually completed.
localDriver.findElement(By.id("peas"));
new WebDriverWait(localDriver, 10).until(presenceOfElementLocated(By.id("peas")));

long start = System.currentTimeMillis();
localDriver.navigate().refresh();
// We discard the element, but want a check to make sure the refresh actually completed.
localDriver.findElement(By.id("peas"));
new WebDriverWait(localDriver, 10).until(presenceOfElementLocated(By.id("peas")));
long end = System.currentTimeMillis();

// The slow loading resource on that page takes 6 seconds to return. If we
Expand All @@ -173,7 +173,7 @@ public void testEagerStrategyShouldWaitForDocumentToBeLoaded() {
localDriver.get(slowPage);

// We discard the element, but want a check to make sure the GET actually completed.
localDriver.findElement(By.tagName("body"));
new WebDriverWait(localDriver, 10).until(presenceOfElementLocated(By.tagName("body")));
}

@Test
Expand Down
2 changes: 1 addition & 1 deletion javascript/firefox-driver/js/nsCommandProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ nsCommandProcessor.prototype.execute = function(jsonCommandString,
return;
}

if(command.name == 'get') {
if(command.name == 'get' || command.name == 'refresh') {
response.session.setWaitForPageLoad(false);
}

Expand Down

0 comments on commit b14d428

Please sign in to comment.