Skip to content
Snippets Groups Projects
Commit d8489ee7 authored by Andreas Tolfsen's avatar Andreas Tolfsen
Browse files

Bug 1411281 - Unmarshal all responses in WPT WebDriver client r=jgraham

The WPT WebDriver client currently only unmarshals responses for some
commands (notably execute_script, execute_async_script, and find.css).
For the client API we want to unmarshal all response bodies automatically.

This patch moves all JSON serialisation/deserialisation to a new
webdriver.protocol package so that it is not scattered around
the client API.  It introduces specialisations of JSONEncoder and
JSONDecoder that allows web element references to be recognised
and converted to complex webdriver.Element objects.

This change means it is no longer necessary for callers to invoke
webdriver.Session._element to convert the response to a web element
as this will be done automatically on any request- and response
body to webdriver.Sesson.send_command.

An important thing to note is that HTTPWireProtocol.send does not  follow
this behaviour by default.  That is because session.transport.send
is used throughout WebDriver tests in WPT as a way to get the raw
JSON body without having to set up session state manually.

MozReview-Commit-ID: 5UyDAe43Hgf

--HG--
extra : rebase_source : b86495dd0dcd102e6dea87011caafad475b88723
parent ca6428c4
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment