-
Notifications
You must be signed in to change notification settings - Fork 850
JsonWireProtocol vs. W3C WebDriver
Ondřej Machulda edited this page Aug 23, 2022
·
6 revisions
This page is work-in-progress part of #469 - it is supposed to summarize differences between legacy JsonWireProtocol and new W3C WebDriver.
| Command | JsonWireProtocol Method |
JsonWireProtocol URI Template |
W3C WebDriver Method |
W3C WebDriver URI Template |
|---|---|---|---|---|
| New Session | POST | /session | POST | /session |
| Returns a list of the currently active sessions | GET | /sessions | - | |
| Retrieve the capabilities of the specified session | GET | /session/:sessionId | - | |
| Delete Session | DELETE | /session/:sessionId | DELETE | /session/{session id} |
| Status | GET | /status | GET | /status |
| Get Timeouts | - | GET | /session/{session id}/timeouts | |
| Set Timeouts | POST | /session/:sessionId/timeouts | POST | /session/{session id}/timeouts |
| Set the asynchronous scripts timeout | POST | /session/:sessionId/timeouts/async_script | - | Removed. Set Timeouts could be used instead. |
| Set the amount of time the driver should wait when searching for elements | POST | /session/:sessionId/timeouts/implicit_wait | - | Removed. Set Timeouts could be used instead. |
| Navigate To | POST | /session/:sessionId/url | POST | /session/{session id}/url |
| Get Current URL | GET | /session/:sessionId/url | GET | /session/{session id}/url |
| Back | POST | /session/:sessionId/back | POST | /session/{session id}/back |
| Forward | POST | /session/:sessionId/forward | POST | /session/{session id}/forward |
| Refresh | POST | /session/:sessionId/refresh | POST | /session/{session id}/refresh |
| Get Title | GET | /session/:sessionId/title | GET | /session/{session id}/title |
| Get Window Handle | GET | /session/:sessionId/window_handle | GET | /session/{session id}/window |
| Close Window | DELETE | /session/:sessionId/window | DELETE | /session/{session id}/window |
| Switch To Window | POST | /session/:sessionId/window | POST | /session/{session id}/window |
| Get Window Handles | GET | /session/:sessionId/window_handles | GET | /session/{session id}/window/handles |
| Switch To Frame | POST | /session/:sessionId/frame | POST | /session/{session id}/frame |
| Switch To Parent Frame | POST | /session/:sessionId/frame/parent | POST | /session/{session id}/frame/parent |
| Get Window Rect | - | GET | /session/{session id}/window/rect | |
| Set Window Rect | - | POST | /session/{session id}/window/rect | |
| Maximize Window | POST | /session/:sessionId/window/:windowHandle/maximize | POST | /session/{session id}/window/maximize |
| Minimize Window | - | POST | /session/{session id}/window/minimize | |
| Fullscreen Window | - | POST | /session/{session id}/window/fullscreen | |
| Get Window Size | GET | /session/:sessionId/window/:windowHandle/size | - | Use via Set Window Rect |
| Set Window Size | POST | /session/:sessionId/window/:windowHandle/size | - | Use via Get Window Rect |
| Change the position of the specified window | POST | /session/:sessionId/window/:windowHandle/position | - | Use via Set Window Rect |
| Get the position of the specified window | GET | /session/:sessionId/window/:windowHandle/position | - | Use via Get Window Rect |
| Get Active Element | POST | /session/:sessionId/element/active | GET | /session/{session id}/element/active |
| Find Element | POST | /session/:sessionId/element | POST | /session/{session id}/element |
| Find Elements | POST | /session/:sessionId/elements | POST | /session/{session id}/elements |
| Find Element From Element | POST | /session/:sessionId/element/:id/element | POST | /session/{session id}/element/{element id}/element |
| Find Elements From Element | POST | /session/:sessionId/element/:id/elements | POST | /session/{session id}/element/{element id}/elements |
| Describe the identified element | GET | /session/:sessionId/element/:id | - | Removed |
| Is Element Selected | GET | /session/:sessionId/element/:id/selected | GET | /session/{session id}/element/{element id}/selected |
| Get Element Attribute | GET | /session/:sessionId/element/:id/attribute/:name | GET | /session/{session id}/element/{element id}/attribute/{name} (should use javascript atom //javascript/webdriver/atoms:get-attribute to read the value) |
| Get Element Property | - | GET | /session/{session id}/element/{element id}/property/{name} | |
| Get Element CSS Value | GET | /session/:sessionId/element/:id/css/:propertyName | GET | /session/{session id}/element/{element id}/css/{property name} |
| Get Element Text | GET | /session/:sessionId/element/:id/text | GET | /session/{session id}/element/{element id}/text |
| Get Element Tag Name | GET | /session/:sessionId/element/:id/name | GET | /session/{session id}/element/{element id}/name |
| Get Element Rect | GET | /session/:sessionId/element/:id/location | GET | /session/{session id}/element/{element id}/rect |
| Is Element Enabled | GET | /session/:sessionId/element/:id/enabled | GET | /session/{session id}/element/{element id}/enabled |
| Element Click | POST | /session/:sessionId/element/:id/click | POST | /session/{session id}/element/{element id}/click |
| Element Clear | POST | /session/:sessionId/element/:id/clear | POST | /session/{session id}/element/{element id}/clear |
| Element Send Keys | POST | /session/:sessionId/element/:id/value | POST | /session/{session id}/element/{element id}/value |
| Send a sequence of key strokes to the active element | POST | /session/:sessionId/keys | - | |
| Submit a FORM element | POST | /session/:sessionId/element/:id/submit | - | Javascript snippet polyfill could be used instead |
| Test if two element IDs refer to the same DOM element | GET | /session/:sessionId/element/:id/equals/:other | - | Removed, could be implemented client-side |
| Determine if an element is currently displayed | GET | /session/:sessionId/element/:id/displayed | - | Atom needs to be used instead: //javascript/atoms/fragments:is-displayed
|
| Determine an element's location on the screen once it has been scrolled into view | GET | /session/:sessionId/element/:id/location_in_view | - | Removed, should be replaced by javascript snippet |
| Determine an element's size in pixels | GET | /session/:sessionId/element/:id/size | - | Use appropriate values from Get Element Rect |
| Get Page Source | GET | /session/:sessionId/source | GET | /session/{session id}/source |
| Execute Script | POST | /session/:sessionId/execute | POST | /session/{session id}/execute/sync |
| Execute Async Script | POST | /session/:sessionId/execute_async | POST | /session/{session id}/execute/async |
| Get All Cookies | GET | /session/:sessionId/cookie | GET | /session/{session id}/cookie |
| Get Named Cookie | - | GET | /session/{session id}/cookie/{name} | |
| Add Cookie | POST | /session/:sessionId/cookie | POST | /session/{session id}/cookie |
| Delete Cookie | DELETE | /session/:sessionId/cookie/:name | DELETE | /session/{session id}/cookie/{name} |
| Delete All Cookies | DELETE | /session/:sessionId/cookie | DELETE | /session/{session id)/cookie |
| Get the current browser orientation | GET | /session/:sessionId/orientation | - | |
| Set the browser orientation | POST | /session/:sessionId/orientation | - | |
| Dismiss Alert | POST | /session/:sessionId/dismiss_alert | POST | /session/{session id}/alert/dismiss |
| Accept Alert | POST | /session/:sessionId/accept_alert | POST | /session/{session id}/alert/accept |
| Get Alert Text | GET | /session/:sessionId/alert_text | GET | /session/{session id}/alert/text |
| Send Alert Text | POST | /session/:sessionId/alert_text | POST | /session/{session id}/alert/text |
| Take Screenshot | GET | /session/:sessionId/screenshot | GET | /session/{session id}/screenshot |
| Take Element Screenshot | - | GET | /session/{session id}/element/{element id}/screenshot |
| Command | JsonWireProtocol Method |
JsonWireProtocol URI Template |
W3C WebDriver Method |
W3C WebDriver URI Template |
|---|---|---|---|---|
| Perform Actions | - | POST | /session/{session id}/actions | |
| Release Actions | - | DELETE | /session/{session id}/actions |
| Command | JsonWireProtocol Method |
JsonWireProtocol URI Template |
W3C WebDriver Method |
W3C WebDriver URI Template |
|---|---|---|---|---|
| Move the mouse by an offset of the specificed element | POST | /session/:sessionId/moveto | - | |
| Click any mouse button (at the coordinates set by the last moveto command) | POST | /session/:sessionId/click | - | |
| Click and hold the left mouse button (at the coordinates set by the last moveto command) | POST | /session/:sessionId/buttondown | - | |
| Releases the mouse button previously held (where the mouse is currently at) | POST | /session/:sessionId/buttonup | - | |
| Double-clicks at the current mouse coordinates (set by moveto) | POST | /session/:sessionId/doubleclick | - | |
| Single tap on the touch enabled device | POST | /session/:sessionId/touch/click | - | |
| Finger down on the screen | POST | /session/:sessionId/touch/down | - | |
| Finger up on the screen | POST | /session/:sessionId/touch/up | - | |
| Finger move on the screen | POST | session/:sessionId/touch/move | - | |
| Scroll on the touch screen using finger based motion events | POST | session/:sessionId/touch/scroll | - | |
| Scroll on the touch screen using finger based motion events | POST | session/:sessionId/touch/scroll | - | |
| Double tap on the touch screen using finger motion events | POST | session/:sessionId/touch/doubleclick | - | |
| Long press on the touch screen using finger motion events | POST | session/:sessionId/touch/longclick | - | |
| Flick on the touch screen using finger motion events | POST | session/:sessionId/touch/flick | - | |
| Flick on the touch screen using finger motion events | POST | session/:sessionId/touch/flick | - | |
| Get the current geo location | GET | /session/:sessionId/location | - | |
| Set the current geo location | POST | /session/:sessionId/location | - | |
| Get all keys of the storage | GET | /session/:sessionId/local_storage | - | |
| Set the storage item for the given key | POST | /session/:sessionId/local_storage | - | |
| Clear the storage | DELETE | /session/:sessionId/local_storage | - | |
| Get the storage item for the given key | GET | /session/:sessionId/local_storage/key/:key | - | |
| Remove the storage item for the given key | DELETE | /session/:sessionId/local_storage/key/:key | - | |
| Get the number of items in the storage | GET | /session/:sessionId/local_storage/size | - | |
| Get all keys of the storage | GET | /session/:sessionId/session_storage | - | |
| Set the storage item for the given key | POST | /session/:sessionId/session_storage | - | |
| Clear the storage | DELETE | /session/:sessionId/session_storage | - | |
| Get the storage item for the given key | GET | /session/:sessionId/session_storage/key/:key | - | |
| Remove the storage item for the given key | DELETE | /session/:sessionId/session_storage/key/:key | - | |
| Get the number of items in the storage | GET | /session/:sessionId/session_storage/size | - | |
| Get the log for a given log type | POST | /session/:sessionId/log | - | |
| Get available log types | GET | /session/:sessionId/log/types | - | |
| Get the status of the html5 application cache | GET | /session/:sessionId/application_cache/status | - | |
| List all available engines on the machine | GET | /session/:sessionId/ime/available_engines | - | |
| Get the name of the active IME engine | GET | /session/:sessionId/ime/active_engine | - | |
| Indicates whether IME input is active at the moment (not if it's available | GET | /session/:sessionId/ime/activated | - | |
| De-activates the currently-active IME engine | POST | /session/:sessionId/ime/deactivate | - | |
| Make an engines that is available (appears on the listreturned by getAvailableEngines) active | POST | /session/:sessionId/ime/activate | - |
POST /session
{
"desiredCapabilities": {
"chromeOptions": {
"binary": "/usr/bin/browser-binary",
"args": ["--headless"]
},
"browserName": "chrome",
"platform": "LINUX",
"requiredCapabilities": {}
}
}W3C WebDriver [ref.]
POST /session
{
"capabilities": {
"alwaysMatch": {
"browserName": "firefox",
"platformName": "linux",
"moz:browserOptions": {
"binary": "/usr/bin/browser-binary",
"args": ["--start-page=http://example.com"],
},
},
"firstMatch": []
}
}
| JsonWireProtocol [ref.] | W3C WebDriver [ref.] | Note |
|---|---|---|
| browserName | browserName | Lowercase |
| version | browserVersion | |
| platform | platformName | Lowercase |
| handlesAlerts | - | |
| cssSelectorsEnabled | - | |
| javascriptEnabled | - | |
| databaseEnabled | - | |
| locationContextEnabled | - | |
| applicationCacheEnabled | - | |
| browserConnectionEnabled | - | |
| webStorageEnabled | - | |
| acceptSslCerts | acceptInsecureCerts | |
| rotatable | - | |
| nativeEvents | - | |
| proxy | proxy | |
| unexpectedAlertBehaviour | - | |
| elementScrollBehavior | - | |
| - | pageLoadStrategy | |
| - | setWindowRect | |
| - | timeouts | |
| - | unhandledPromptBehavior | |
| - | :browserSpecificCapability | Custom browser capabilities extension |