Skip to content

Commit b14d428

Browse files
committed
Fixing eager page load strategy in Firefox on page refresh
1 parent eff8b88 commit b14d428

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

Diff for: common/src/web/slowLoadingResourcePage.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
too long to respond. Normally these things are loaded in an iframe, which is
88
what we're doing here.</p>
99

10-
<img src="sleep?time=6"></img>
10+
<img src="sleep?time=7"></img>
1111
</body>
12-
</html>
12+
</html>

Diff for: java/client/test/org/openqa/selenium/PageLoadingTest.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public void testEagerStrategyShouldNotWaitForResources() {
131131
localDriver.get(slowPage);
132132
// We discard the element, but want a check to make sure the GET actually
133133
// completed.
134-
localDriver.findElement(By.id("peas"));
134+
new WebDriverWait(localDriver, 10).until(presenceOfElementLocated(By.id("peas")));
135135
long end = System.currentTimeMillis();
136136

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

143-
@Ignore(value = {FIREFOX, IE, CHROME, SAFARI, MARIONETTE, PHANTOMJS, HTMLUNIT})
143+
@Ignore(value = {IE, CHROME, SAFARI, MARIONETTE, PHANTOMJS, HTMLUNIT})
144144
@NeedsLocalEnvironment
145145
@Test
146146
public void testEagerStrategyShouldNotWaitForResourcesOnRefresh() {
@@ -150,12 +150,12 @@ public void testEagerStrategyShouldNotWaitForResourcesOnRefresh() {
150150

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

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

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

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

179179
@Test

Diff for: javascript/firefox-driver/js/nsCommandProcessor.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ nsCommandProcessor.prototype.execute = function(jsonCommandString,
505505
return;
506506
}
507507

508-
if(command.name == 'get') {
508+
if(command.name == 'get' || command.name == 'refresh') {
509509
response.session.setWaitForPageLoad(false);
510510
}
511511

0 commit comments

Comments
 (0)