webdriver for chrome
DESCRIPTION
WebDriver for chromeTRANSCRIPT
WebDriver for ChromeKen Kania, Google
Google Confidential and Proprietary
WebDriver for Chrome
Ken Kania
Google Confidential and Proprietary
Problem
● Over 300 million active Chrome users, spread across
o Windows
o Mac
o Linux
o ChromeOS
o Android
o iOS
● As a webapp developer, how can I automatically verify the critical functionality of my app works for all these users?
Google Confidential and Proprietary
Solution - ChromeDriver
● Follows the W3C WebDriver working draft
● Interoperable with the open source WebDriver clients
● Open source and maintained by members of the Chromium project
Google Confidential and Proprietary
WebDriver
● WebDriver is a cross-browser automation API primarily for website testing
API covers:
● Browser control
o navigation, snapshotting, window control, override geolocation
● User input simulation
o mouse, keyboard, file uploads, alert handling
● Web stuff
o find/query elements, evaluate JavaScript, manipulate cookies
Google Confidential and Proprietary
driver = webdriver.Chrome('chromedriver.exe')
driver.get('http://www.google.com/xhtml');
search_box = driver.find_element_by_name('q')
search_box.send_keys('ChromeDriver')
search_box.submit()
self.assertTrue('ChromeDriver' in driver.title)
driver.quit()
What does a test look like?
Google Confidential and Proprietary
How can I use it?
● Windows / Mac / Linux
o See Getting Started
● Android (alpha)
o See Getting Started
o Need Mac / Linux host connected to USB debug enabled device
o Specify android_package session capability
● ChromeOS (pre-alpha)
o Oops, you cannot yet!
● iOS (pre-alpha)
o Oops, you cannot yet!
Google Confidential and Proprietary
How does it work?
Chrome Browser
Chrome Driver
TestWebDriver
Library
WebDriver client WebDriver server
WebDriver protocol DevTools / Extensions
Google Confidential and Proprietary
ChromeDriver Implementation
● DevTools
o Provide access to internals of web app
Query and manipulate DOM tree
Debug JavaScript
Memory and performance profiling
Network traffic monitoring
o Supported on all Chrome platforms, except iOS
● Extensions
o Modify and enhance the browser functionality
Window control
Query in progress and finished user downloads
Google Confidential and Proprietary
ChromeDriver Implementation cont'd
ChromeDriver
Browser
HTTP Server
Session
Session
DevTools Server
Renderer
Chrome Driver
Extension
Extension Function
Dispatcher
DevTools Agent
Renderer
Web App
DevTools Agent
Google Confidential and Proprietary
Future Work
● General
o Memory and performance measurement APIs
o Testing Chrome extensions
● Android
o Support upcoming Chrome backed WebView
o Run driver on device (i.e., no host necessary)
● iOS
o UIWebView limitations
o Still in early stages
Google Confidential and Proprietary
The End
● Getting help
o ChromeDriver issue tracker
● Get the source