Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

A Deep Dive into the W3C WebDriver Specification


Published on

Selenium Conf Tokyo 2019

Published in: Software

A Deep Dive into the W3C WebDriver Specification

  1. 1. Peter Thomas | Distinguished Engineer | Intuit @ptrthomas
  2. 2. 2 About Me
  3. 3. 3 Agenda What is WebDriver ? Architecture Examples and Demos
  4. 4. 4 Scope of this talk Selenium Language Bindings Selenium IDE Selenium Grid Selenium the “brand” Also known as “Selenium WebDriver” the W3C WebDriver Specification use uses uses we will focus here in this talk
  5. 5. 5 a W3C Specification WebDriver is … “WebDriver is a remote control interface that enables introspection and control of user agents. It provides a platform and language-neutral wire protocol as a way for out-of-process programs to remotely instruct the behavior of web browsers.” REST API e.g. Web Browsers JSON over HTTP e.g. Selenium … or even Mobile / Desktop Apps
  6. 6. 6 Simon Mavi Stewart @shs96c W3C WebDriver Specification - Editors David Burns @AutomatedTester Browser Testing and Tools Working Group
  7. 7. 7 WebDriver in your stack Browser DriverBindings JSON over HTTP WebDriver REST API Framework FireFoxgeckodriverSelenium (Java)JUnit ChromechromedriverSelenium (Ruby)WatirRSpec WebdriverIO or Nightwatch.jsMocha Emulates User Controls Browser Exposes REST API Manages Sessions Language Specific WebDriver SDK Driver client Higher Level API Test Assertions Run / Reports Config / Tags etc. Selenium (Python) Selenium Base Pytest Implemented By Browser Vendors
  8. 8. 8 History : Selenium  WebDriver  W3C Selenium 2 Released 2011 W3C Specification Work 2018 W3C Recommendation Selenium & WebDriver Merge Selenium Core Browser Selenium RC WebDriver Se IDE 2008-9 (Selenium Grid not shown for simplicity) Feb 2008 Selenium Core Browser Selenium RC Se IDE 2004 Jason Huggins Paul Hammant Selenium Created 2016 Selenium 3 Released Browser WebDriver (drivers) JSON Wire Protocol Selenium (bindings) WebDriver (W3C drivers) Browser Selenium IDE (new) Selenium (bindings) W3C Protocol 2006-7 Simon Stewart WebDriver WebDriver Created Browser
  9. 9. 9 Method URI Template Command POST /session New Session DELETE /session/{session id} Delete Session GET /status Status GET /session/{session id}/timeouts Get Timeouts POST /session/{session id}/timeouts Set Timeouts POST /session/{session id}/url Navigate To GET /session/{session id}/url Get Current URL POST /session/{session id}/back Back POST /session/{session id}/forward Forward POST /session/{session id}/refresh Refresh GET /session/{session id}/title Get Title GET /session/{session id}/window Get Window Handle DELETE /session/{session id}/window Close Window POST /session/{session id}/window Switch To Window GET /session/{session id}/window/handles Get Window Handles POST /session/{session id}/window/new New Window POST /session/{session id}/frame Switch To Frame POST /session/{session id}/frame/parent Switch To Parent Frame GET /session/{session id}/window/rect Get Window Rect POST /session/{session id}/window/rect Set Window Rect POST /session/{session id}/window/maximize Maximize Window POST /session/{session id}/window/minimize Minimize Window POST /session/{session id}/window/fullscreen Fullscreen Window GET /session/{session id}/element/active Get Active Element POST /session/{session id}/element Find Element POST /session/{session id}/elements Find Elements Method URI Template Command POST /session/{session id}/element/{element id}/element Find Element From Element POST /session/{session id}/element/{element id}/elements Find Elements From Element GET /session/{session id}/element/{element id}/selected Is Element Selected GET /session/{session id}/element/{element id}/attribute/{name} Get Element Attribute GET /session/{session id}/element/{element id}/property/{name} Get Element Property GET /session/{session id}/element/{element id}/css/{property name} Get Element CSS Value GET /session/{session id}/element/{element id}/text Get Element Text GET /session/{session id}/element/{element id}/name Get Element Tag Name GET /session/{session id}/element/{element id}/rect Get Element Rect GET /session/{session id}/element/{element id}/enabled Is Element Enabled POST /session/{session id}/element/{element id}/click Element Click POST /session/{session id}/element/{element id}/clear Element Clear POST /session/{session id}/element/{element id}/value Element Send Keys GET /session/{session id}/source Get Page Source POST /session/{session id}/execute/sync Execute Script POST /session/{session id}/execute/async Execute Async Script GET /session/{session id}/cookie Get All Cookies GET /session/{session id}/cookie/{name} Get Named Cookie POST /session/{session id}/cookie Add Cookie DELETE /session/{session id}/cookie/{name} Delete Cookie DELETE /session/{session id}/cookie Delete All Cookies POST /session/{session id}/actions Perform Actions DELETE /session/{session id}/actions Release Actions POST /session/{session id}/alert/dismiss Dismiss Alert POST /session/{session id}/alert/accept Accept Alert GET /session/{session id}/alert/text Get Alert Text POST /session/{session id}/alert/text Send Alert Text GET /session/{session id}/screenshot Take Screenshot GET /session/{session id}/element/{element id}/screenshot Take Element Screenshot WebDriver Commands Session Management Navigation Title Window Frame Window Size Get / Find Element(s) Find Element(s) from Element Element State Element Actions Page Source Execute Script Cookies Keyboard / Mouse / Touch Alert / Dialog Screenshot
  10. 10. 10 curl -d '{"desiredCapabilities":{"browserName":"Chrome"}}' -X POST http://localhost:9515/session curl -d '{"url":""}' -X POST http://localhost:9515/session/{session id}/url curl -d '{"using":"css selector","value":"#login_field"}' -X POST http://localhost:9515/session/{session id}/element curl -d '{"value":["hello"]}' -X POST http://localhost:9515/session/{session id}/element/{element id}/value Demo: Browser Remote Control with cURL First, start chromedriver, default port: 9515
  11. 11. 11 • API Testing • API Mocking • API Perf-Testing Example Framework - Karate Takanori Suzuki Open Source Test Automation Framework @KarateDS L
  12. 12. 12 W3C WebDriver support in Karate (Alpha) BrowserDriverBindings JSON over HTTP WebDriver REST API Framework Chromechromedriver Windows AppWinAppDriverREST HTTP Client W3C WebDriver Adapter Karate Script (Gherkin) Karate Core (Java) Since Dec 2018 From Microsoft
  13. 13. Demo
  14. 14. 14 Drivers Target Driver Chrome chromedriver FireFox geckodriver Safari safaridriver (Mac) MS Edge MicrosoftWebDriver (Win 10) (Windows Apps) WinAppDriver (Win 10) Internet Explorer IEDriverServer (Win) Only driver maintained by the Selenium team (planned end of support: Jul 19) Jim Evans | @jimevansmusic also known for the Selenium + WebDriver compliance tests
  15. 15. 15 Spec Compliance is hard work …
  16. 16. 16 A Word about Microsoft Edge The MS Edge browser will be based on Chromium in the future Will it support WebDriver ?
  17. 17. 17 WebDriver Bindings and Frameworks Binding Language Link Selenium Java Selenium Python Selenium Ruby Selenium .NET Selenium JavaScript WebdriverIO JavaScript Nightwatch.js JavaScript Karate (Alpha) Java Framework Language Uses Link Selenide Java Selenium Java SeleniumBase Python Selenium Python Watir Ruby Selenium Ruby Protractor JavaScript Selenium JavaScript (not an exhaustive list)
  18. 18. 18 Stable User-Facing API-s / W3C Only Selenium Grid / Docker / Cloud Tracing / Observability Site / Documentation Friendly Locators Selenium IDE The Future – Expected in Selenium 4
  19. 19. Q & A @ptrthomas Thank You !
  20. 20. 21 References (1 of 2) WebDriver GitHub: Selenium WebDriver (New Documentation): The Architecture of Open Source Applications: Selenium WebDriver - Selenium 1 / Remote Control (RC): Selenium History: Selenium History: GTAC 2007: Huggins & Stewart - Selenium-RC Vs WebDriver: Happy 10th Birthday, Selenium (by Paul Hammant): The Faces Behind Selenium: Selenium User Meetup 2008 at Google (lightning talks, venue of photo on slide #7): Summary of the above event (Matt Raible’s blog): Selenium Contributors (old site): WebDriver W3C Draft Announcement:
  21. 21. 22 References (2 of 2) Selenium 2 Announcement: Selenium 2 to 3 changes: Selenium 3 Announcement: Selenium 4 changes: Selenium State of the Union (Se Conf Chicago 18): Selenium 4 Project Board (GitHub): Sauce Labs Selenium 4 FAQ: Selenium and WebDriverIO: Evaluating Cypress and TestCafe: Comparison of E2E Testing Tools: Selenium Atoms: Watir History: