Bug 1410799 - Fix HTTP status for stale element reference error r=jgraham
authorAndreas Tolfsen <ato@sny.no>
Wed, 01 Nov 2017 18:02:15 +0000
changeset 443115 218cfcb9dbfdc528bee425477614ba5da0264e02
parent 443114 f99477c499ab89d81cad2a76f2586f97a51ef0a9
child 443116 23589b9af885bb153ca487974f9c1c764d631f07
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgraham
bugs1410799
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1410799 - Fix HTTP status for stale element reference error r=jgraham The HTTP status for the "stale element reference" error in WebDriver should be 404 (Not Found). MozReview-Commit-ID: CBb7Ds8AEY3
testing/geckodriver/CHANGES.md
testing/web-platform/tests/tools/webdriver/webdriver/error.py
testing/web-platform/tests/webdriver/tests/support/asserts.py
testing/webdriver/src/error.rs
--- a/testing/geckodriver/CHANGES.md
+++ b/testing/geckodriver/CHANGES.md
@@ -3,16 +3,19 @@ Change log
 
 All notable changes to this program is documented in this file.
 
 Unreleased
 ----------
 
 ### Changed
 
+- HTTP status code for the [`StaleElementReference`] error changed
+  from 400 (Bad Request) to 404 (Not Found)
+
 - Backtraces from geckodriver no longer substitute for missing
   Marionette stacktraces
 
 
 0.19.1 (2017-10-30)
 -------------------
 
 ### Changed
@@ -785,16 +788,17 @@ 0.1.0 (2015-04-09)
 [`MinimizeWindow`]: https://docs.rs/webdriver/newest/webdriver/command/enum.WebDriverCommand.html#variant.MinimizeWindow
 [`NewSession`]: https://docs.rs/webdriver/newest/webdriver/command/enum.WebDriverCommand.html#variant.NewSession
 [`NoSuchCookie`]: https://docs.rs/webdriver/newest/webdriver/error/enum.ErrorStatus.html#variant.NoSuchCookie
 [`RectResponse`]: https://docs.rs/webdriver/0.27.0/webdriver/response/struct.RectResponse.html
 [`SendKeysParameters`]: https://docs.rs/webdriver/newest/webdriver/command/struct.SendKeysParameters.html
 [`SessionNotCreated`]: https://docs.rs/webdriver/newest/webdriver/error/enum.ErrorStatus.html#variant.SessionNotCreated
 [`SetTimeouts`]: https://docs.rs/webdriver/newest/webdriver/command/enum.WebDriverCommand.html#variant.SetTimeouts
 [`SetWindowRect`]: https://docs.rs/webdriver/newest/webdriver/command/enum.WebDriverCommand.html#variant.SetWindowRect
+[`StaleElementReference`]: https://docs.rs/webdriver/newest/webdriver/error/enum.ErrorStatus.html#variant.StaleElementReference
 [`UnableToCaptureScreen`]: https://docs.rs/webdriver/newest/webdriver/error/enum.ErrorStatus.html#variant.UnableToCaptureScreen
 [`UnknownCommand`]: https://docs.rs/webdriver/newest/webdriver/error/enum.ErrorStatus.html#variant.UnknownCommand
 [`UnknownError`]: https://docs.rs/webdriver/newest/webdriver/error/enum.ErrorStatus.html#variant.UnknownError
 [`WindowRectParameters`]: https://docs.rs/webdriver/newest/webdriver/command/struct.WindowRectParameters.html
 
 [mozrunner crate]: https://crates.io/crates/mozrunner
 [webdriver crate]: https://crates.io/crates/webdriver
 
--- a/testing/web-platform/tests/tools/webdriver/webdriver/error.py
+++ b/testing/web-platform/tests/tools/webdriver/webdriver/error.py
@@ -102,17 +102,17 @@ class ScriptTimeoutException(WebDriverEx
 
 
 class SessionNotCreatedException(WebDriverException):
     http_status = 500
     status_code = "session not created"
 
 
 class StaleElementReferenceException(WebDriverException):
-    http_status = 400
+    http_status = 404
     status_code = "stale element reference"
 
 
 class TimeoutException(WebDriverException):
     http_status = 408
     status_code = "timeout"
 
 
--- a/testing/web-platform/tests/webdriver/tests/support/asserts.py
+++ b/testing/web-platform/tests/webdriver/tests/support/asserts.py
@@ -16,17 +16,17 @@ errors = {
     "move target out of bounds": 500,
     "no such alert": 404,
     "no such cookie": 404,
     "no such element": 404,
     "no such frame": 404,
     "no such window": 404,
     "script timeout": 408,
     "session not created": 500,
-    "stale element reference": 400,
+    "stale element reference": 404,
     "timeout": 408,
     "unable to set cookie": 500,
     "unable to capture screen": 500,
     "unexpected alert open": 500,
     "unknown command": 404,
     "unknown error": 500,
     "unknown method": 405,
     "unsupported operation": 500,
--- a/testing/webdriver/src/error.rs
+++ b/testing/webdriver/src/error.rs
@@ -196,17 +196,17 @@ impl ErrorStatus {
             MoveTargetOutOfBounds => InternalServerError,
             NoSuchAlert => NotFound,
             NoSuchCookie => NotFound,
             NoSuchElement => NotFound,
             NoSuchFrame => NotFound,
             NoSuchWindow => NotFound,
             ScriptTimeout => RequestTimeout,
             SessionNotCreated => InternalServerError,
-            StaleElementReference => BadRequest,
+            StaleElementReference => NotFound,
             Timeout => RequestTimeout,
             UnableToCaptureScreen => BadRequest,
             UnableToSetCookie => InternalServerError,
             UnexpectedAlertOpen => InternalServerError,
             UnknownCommand => NotFound,
             UnknownError => InternalServerError,
             UnknownMethod => MethodNotAllowed,
             UnknownPath => NotFound,