diff --git a/java/client/src/org/openqa/selenium/remote/RemoteWebDriver.java b/java/client/src/org/openqa/selenium/remote/RemoteWebDriver.java index fd1aea0e6bc0c..b68ac5770ff63 100644 --- a/java/client/src/org/openqa/selenium/remote/RemoteWebDriver.java +++ b/java/client/src/org/openqa/selenium/remote/RemoteWebDriver.java @@ -833,22 +833,19 @@ protected class RemoteTimeouts implements Timeouts { public Timeouts implicitlyWait(long time, TimeUnit unit) { execute(DriverCommand.SET_TIMEOUT, ImmutableMap.of( - "type", "implicit", - "ms", TimeUnit.MILLISECONDS.convert(time, unit))); + "implicit", TimeUnit.MILLISECONDS.convert(time, unit))); return this; } public Timeouts setScriptTimeout(long time, TimeUnit unit) { execute(DriverCommand.SET_TIMEOUT, ImmutableMap.of( - "type", "script", - "ms", TimeUnit.MILLISECONDS.convert(time, unit))); + "script", TimeUnit.MILLISECONDS.convert(time, unit))); return this; } public Timeouts pageLoadTimeout(long time, TimeUnit unit) { execute(DriverCommand.SET_TIMEOUT, ImmutableMap.of( - "type", "page load", - "ms", TimeUnit.MILLISECONDS.convert(time, unit))); + "page load", TimeUnit.MILLISECONDS.convert(time, unit))); return this; } } // timeouts class. diff --git a/java/client/src/org/openqa/selenium/remote/http/JsonHttpCommandCodec.java b/java/client/src/org/openqa/selenium/remote/http/JsonHttpCommandCodec.java index 3533c5e6b7e0f..82f99089c1a91 100644 --- a/java/client/src/org/openqa/selenium/remote/http/JsonHttpCommandCodec.java +++ b/java/client/src/org/openqa/selenium/remote/http/JsonHttpCommandCodec.java @@ -65,6 +65,7 @@ import com.google.common.collect.ImmutableMap; +import org.openqa.selenium.InvalidArgumentException; import org.openqa.selenium.remote.DriverCommand; import java.util.Map; @@ -147,6 +148,18 @@ public JsonHttpCommandCodec() { .put("handle", "current") .build(); + case DriverCommand.SET_TIMEOUT: + if (parameters.size() != 1) { + throw new InvalidArgumentException( + "The JSON wire protocol only supports setting one time out at a time"); + } + Map.Entry entry = parameters.entrySet().iterator().next(); + String type = entry.getKey(); + if ("pageLoad".equals(type)) { + type = "page load"; + } + return ImmutableMap.of("type", type, "ms", entry.getValue()); + case DriverCommand.SWITCH_TO_WINDOW: return ImmutableMap.builder() .put("name", parameters.get("handle")) diff --git a/java/client/test/org/openqa/selenium/PageLoadingTest.java b/java/client/test/org/openqa/selenium/PageLoadingTest.java index 456e759287410..50cd53a749a9f 100644 --- a/java/client/test/org/openqa/selenium/PageLoadingTest.java +++ b/java/client/test/org/openqa/selenium/PageLoadingTest.java @@ -398,6 +398,7 @@ public void testShouldNotHangIfDocumentOpenCallIsNeverFollowedByDocumentCloseCal @Ignore(value = {HTMLUNIT, SAFARI, PHANTOMJS, FIREFOX}, reason = "Safari: see issue 687, comment 41; PHANTOMJS: not tested", issues = {687}) @NeedsLocalEnvironment + @NotYetImplemented(MARIONETTE) @NoDriverAfterTest @Test public void testPageLoadTimeoutCanBeChanged() { @@ -539,8 +540,8 @@ private void testPageLoadTimeoutIsEnforced(long webDriverPageLoadTimeout) { long start = System.currentTimeMillis(); try { - driver - .get(appServer.whereIs("sleep?time=" + (webDriverPageLoadTimeout + pageLoadTimeBuffer))); + driver.get(appServer.whereIs( + "sleep?time=" + (webDriverPageLoadTimeout + pageLoadTimeBuffer))); fail("I should have timed out after " + webDriverPageLoadTimeout + " seconds"); } catch (RuntimeException e) { long end = System.currentTimeMillis();