Skip to content

Commit

Permalink
Handle Safari 11 and Edge 17 stale reference error (#413)
Browse files Browse the repository at this point in the history
Edge 17 responds with: "Stale element..." (uppercase S)
Safari 11 responds with: "An element command failed..."
  • Loading branch information
michallepicki authored and keathley committed Feb 6, 2019
1 parent 520ba8e commit c554733
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/wallaby/httpclient.ex
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,17 @@ defmodule Wallaby.HTTPClient do
end
end

# credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity
defp check_for_response_errors(response) do
case Map.get(response, "value") do
%{"class" => "org.openqa.selenium.StaleElementReferenceException"} ->
{:error, :stale_reference}
%{"message" => "Stale element reference" <> _} ->
{:error, :stale_reference}
%{"message" => "stale element reference" <> _} ->
{:error, :stale_reference}
%{"message" => "An element command failed because the referenced element is no longer available" <> _} ->
{:error, :stale_reference}
%{"message" => "invalid selector" <> _} ->
{:error, :invalid_selector}
%{"class" => "org.openqa.selenium.InvalidSelectorException"} ->
Expand Down

0 comments on commit c554733

Please sign in to comment.