Sie sind auf Seite 1von 12

WebDriver for Chrome

Ken Kania, Google

WebDriver for Chrome


Ken Kania

Google Confidential and Proprietary

Problem
Over 300 million active Chrome users, spread across
o

Windows

Mac

Linux

ChromeOS

Android

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

What does a test look like?


driver = w ebdriver.Chrom e('chrom edriver.exe')
driver.get('http://w w w .google.com /xhtm l');
search_box = driver.fi
nd_elem ent_by_nam e('q')
search_box.send_keys('Chrom eD river')
search_box.subm it()
self.assertTrue('Chrom eD river'in driver.title)
driver.quit()
Google Confidential and Proprietary

How can I use it?


Windows / Mac / Linux
o

See Getting Started

Android (alpha)
o

See Getting Started

Need Mac / Linux host connected to USB debug enabled device

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?

WebDriver protocol

Test

WebDriver
Library

WebDriver client

DevTools / Extensions

Chrome
Driver

Chrome
Browser

WebDriver server

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

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


Browser
ChromeDriver
HTTP
Server

DevTools
Server

Session

Extension
Function
Dispatcher

Session
DevTools
Agent
Web App

DevTools
Agent

Chrome
Driver
Extension

Renderer

Renderer
Google Confidential and Proprietary

Future Work
General
o

Memory and performance measurement APIs

Testing Chrome extensions

Android
o Support upcoming Chrome backed WebView
o

Run driver on device (i.e., no host necessary)

iOS
o

UIWebView limitations

Still in early stages

Google Confidential and Proprietary

The End
Getting help
o

ChromeDriver issue tracker

chromedriver-users@googlegroups.com

Get the source

Google Confidential and Proprietary

Das könnte Ihnen auch gefallen