Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Issue 3064012: Base implementation of WebDriver for Chrome. This checkin includes... (Closed)

Created:
10 years, 5 months ago by Joe
Modified:
9 years, 7 months ago
CC:
chromium-reviews, Paweł Hajdan Jr., AmolKher, jleyba, jarbon_google.com
Visibility:
Public.

Description

Base implementation of WebDriver for Chrome. WebDriver is a tool for automating testing web applications, and in particular to verify that they work as expected. It aims to provide a friendly API that's easy to explore and understand, which will help make your tests easier to read and maintain. It's not tied to any particular test framework, so it can be used equally well with JUnit, TestNG or from a plain old "main" method. This checkin includes all that it necessary to implement the JSON over HTTP protocol for WebDriver along with the /session and /session/sessionID URLs. Each URL is added under the webdriver/command directory. To run simply run execute webdriver command, on linux you may need to add the path to chrome to your enviroment settings. A port can be specified with the --port option, by default webdriver will listen in on port 8080. Note: A total refactor of my original code was done by Jason Leyba (jleyba). All of his changes are included in this checkin For further reference on the WebDriver remote protocol see: http://code.google.com/p/selenium/wiki/JsonWireProtocol BUG=none TEST=Start webdriver then run the file webdriver_tests.py Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=56626

Patch Set 1 : '' #

Total comments: 191

Patch Set 2 : '' #

Total comments: 39

Patch Set 3 : '' #

Total comments: 44

Patch Set 4 : '' #

Total comments: 4

Patch Set 5 : '' #

Patch Set 6 : '' #

Patch Set 7 : '' #

Patch Set 8 : '' #

Patch Set 9 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+2271 lines, -0 lines) Patch
M chrome/chrome_tests.gypi View 1 2 3 4 5 6 7 8 1 chunk +108 lines, -0 lines 0 comments Download
A chrome/test/webdriver/commands/command.h View 1 2 3 1 chunk +71 lines, -0 lines 0 comments Download
A chrome/test/webdriver/commands/command.cc View 1 2 3 4 1 chunk +18 lines, -0 lines 0 comments Download
A chrome/test/webdriver/commands/create_session.h View 1 chunk +37 lines, -0 lines 0 comments Download
A chrome/test/webdriver/commands/create_session.cc View 1 chunk +34 lines, -0 lines 0 comments Download
A chrome/test/webdriver/commands/response.h View 2 3 4 1 chunk +76 lines, -0 lines 0 comments Download
A chrome/test/webdriver/commands/session_with_id.h View 1 chunk +43 lines, -0 lines 0 comments Download
A chrome/test/webdriver/commands/session_with_id.cc View 4 1 chunk +48 lines, -0 lines 0 comments Download
A chrome/test/webdriver/commands/webdriver_command.h View 1 2 3 4 1 chunk +61 lines, -0 lines 0 comments Download
A chrome/test/webdriver/commands/webdriver_command.cc View 1 2 3 4 1 chunk +77 lines, -0 lines 0 comments Download
A chrome/test/webdriver/dispatch.h View 1 2 3 1 chunk +77 lines, -0 lines 0 comments Download
A chrome/test/webdriver/dispatch.cc View 1 2 3 4 1 chunk +199 lines, -0 lines 0 comments Download
A chrome/test/webdriver/error_codes.h View 1 1 chunk +33 lines, -0 lines 0 comments Download
A chrome/test/webdriver/keymap.h View 1 2 3 1 chunk +39 lines, -0 lines 0 comments Download
A chrome/test/webdriver/keymap.cc View 1 2 3 1 chunk +174 lines, -0 lines 0 comments Download
A chrome/test/webdriver/server.cc View 1 2 3 1 chunk +118 lines, -0 lines 0 comments Download
A chrome/test/webdriver/session.h View 3 1 chunk +105 lines, -0 lines 0 comments Download
A chrome/test/webdriver/session.cc View 3 4 5 6 7 1 chunk +288 lines, -0 lines 0 comments Download
A chrome/test/webdriver/session_manager.h View 1 2 3 4 1 chunk +53 lines, -0 lines 0 comments Download
A chrome/test/webdriver/session_manager.cc View 1 2 3 4 5 6 7 1 chunk +251 lines, -0 lines 0 comments Download
A chrome/test/webdriver/utility_functions.h View 1 2 1 chunk +32 lines, -0 lines 0 comments Download
A chrome/test/webdriver/utility_functions.cc View 1 2 1 chunk +88 lines, -0 lines 0 comments Download
A chrome/test/webdriver/webdriver_tests.py View 1 2 3 1 chunk +241 lines, -0 lines 0 comments Download

Messages

Total messages: 14 (0 generated)
jcarollo1
Here's comments on the first few files. I'll append more in a bit. http://codereview.chromium.org/3064012/diff/52001/53001 File ...
10 years, 5 months ago (2010-07-28 02:46:14 UTC) #1
jcarollo1
More comments. http://codereview.chromium.org/3064012/diff/52001/53005 File chrome/test/webdriver/commands/session_command.h (right): http://codereview.chromium.org/3064012/diff/52001/53005#newcode16 chrome/test/webdriver/commands/session_command.h:16: class SessionCommand: public Command { class SessionCommand ...
10 years, 5 months ago (2010-07-28 03:03:10 UTC) #2
John Grabowski
Please let's try and break things up more next time; this took forever to review. ...
10 years, 5 months ago (2010-07-28 03:57:25 UTC) #3
Joe
1st round of fixes I should note that with the structure we have now each ...
10 years, 4 months ago (2010-07-29 00:58:31 UTC) #4
John Grabowski
http://codereview.chromium.org/3064012/diff/52001/53003 File chrome/test/webdriver/commands/command.h (right): http://codereview.chromium.org/3064012/diff/52001/53003#newcode80 chrome/test/webdriver/commands/command.h:80: inline Command(const std::string& method, On 2010/07/29 00:58:31, Joe wrote: ...
10 years, 4 months ago (2010-07-29 18:10:55 UTC) #5
Nirnimesh
I've taken only a cursory look. 1. It appears to me that a huge bunch ...
10 years, 4 months ago (2010-07-30 07:22:44 UTC) #6
Joe
Note: I am a significant change in how commands are executed and removed passing in ...
10 years, 4 months ago (2010-08-03 17:31:21 UTC) #7
John Grabowski
Glad to see this making progress. Are you ready for re-review? jrg On Tue, Aug ...
10 years, 4 months ago (2010-08-03 17:37:06 UTC) #8
amolk
http://codereview.chromium.org/3064012/diff/41003/14026 File chrome/test/webdriver/commands/session_command.cc (right): http://codereview.chromium.org/3064012/diff/41003/14026#newcode54 chrome/test/webdriver/commands/session_command.cc:54: temp_value->SetBoolean(std::wstring(L"javascriptEnabled"), true); Is this because Chrome cannot be run ...
10 years, 4 months ago (2010-08-03 22:36:50 UTC) #9
Joe
http://codereview.chromium.org/3064012/diff/41003/14026 File chrome/test/webdriver/commands/session_command.cc (right): http://codereview.chromium.org/3064012/diff/41003/14026#newcode54 chrome/test/webdriver/commands/session_command.cc:54: temp_value->SetBoolean(std::wstring(L"javascriptEnabled"), true); We currently require javascript to always run ...
10 years, 4 months ago (2010-08-03 22:45:43 UTC) #10
John Grabowski
Looking a lot better. Most of my remaining comments relates to comments or naming. http://codereview.chromium.org/3064012/diff/52001/53004 ...
10 years, 4 months ago (2010-08-05 03:01:17 UTC) #11
Joe
I am also writing up 2 docs to publish to the chromium website. One will ...
10 years, 4 months ago (2010-08-10 01:05:07 UTC) #12
Nirnimesh
Following up on the discussion we had offline about reusing as much code as possible ...
10 years, 4 months ago (2010-08-10 20:46:27 UTC) #13
John Grabowski
10 years, 4 months ago (2010-08-12 07:43:55 UTC) #14
LGTM.  Land it!

Really great to see this develop.

Please remember to look at the routines Nirnimesh pointed you at (e.g.
UITestBase::SetUp) as follow-up to see if we can reuse a bunch of code make
PyAuto/ChromeDriver integration easier.

http://codereview.chromium.org/3064012/diff/41003/14039
File chrome/test/webdriver/session_manager.h (right):

http://codereview.chromium.org/3064012/diff/41003/14039#newcode18
chrome/test/webdriver/session_manager.h:18: class SessionManager {
On 2010/08/10 01:05:07, Joe wrote:
> With the webdriver the user is allowed multiple instances of the browser on
the
> same machine.  So 2 sessions open would mean you would have 2 instances of
> chrome running under their own profiles.
> 
> On 2010/08/05 03:01:17, John Grabowski wrote:
> > What does it mean to have 2 sessions?  Does that mean we're running 2
chromes?
> > 
> 
> 

Plz add comment to that effect in code

http://codereview.chromium.org/3064012/diff/41003/14039#newcode36
chrome/test/webdriver/session_manager.h:36: Lock session_generation;
On 2010/08/10 01:05:07, Joe wrote:
> Session manager keeps track of all of the session that are currently running
on
> the machine under test.  We record the address and port for the HTTP 303 See
> other redirect.
> 
> We save the IP and Port of the machine chromedriver is running on since we
send
> a HTTP 303, see other, after a successful creation of a session, ie:
> http://172.22.41.105:8080/session/DFSSE453CV588
> 
> On 2010/08/05 03:01:17, John Grabowski wrote:
> > Trailing _ for these 3
> > 
> > What do these mean?  Why does a session manager have an addr and port?  I
> > understand if a session does, but not the session manager.
> > 
> 
> 

Very helpful.  Please add this comment in the code.

http://codereview.chromium.org/3064012/diff/76001/77001
File chrome/chrome_tests.gypi (right):

http://codereview.chromium.org/3064012/diff/76001/77001#newcode442
chrome/chrome_tests.gypi:442: # wire protcol.  A description of the WebDriver
and examples can
"Chromedriver is a stand-alone process that implements the WebDriver wire
protocol.  It talks to Chrome over the automation proxy".  Be clear this isn't
compiled into Chrome.

http://codereview.chromium.org/3064012/diff/76001/77005
File chrome/test/webdriver/commands/create_session.h (right):

http://codereview.chromium.org/3064012/diff/76001/77005#newcode16
chrome/test/webdriver/commands/create_session.h:16: // Create a new session
which is a new instance of the chrome browser with no
Excellent; great clarity.

http://codereview.chromium.org/3064012/diff/76001/77008
File chrome/test/webdriver/commands/session_with_id.h (right):

http://codereview.chromium.org/3064012/diff/76001/77008#newcode23
chrome/test/webdriver/commands/session_with_id.h:23: class SessionWithID :
public WebDriverCommand {
To be honest, I still dislike the name of this class.
It is a command for querying or closing the session.
It isn't a "session object" per se.
This I'd expect it to be called ProbeOrCloseSession.
But we've talked about this so if you still like it I'll let it go.

http://codereview.chromium.org/3064012/diff/76001/77010
File chrome/test/webdriver/commands/webdriver_command.h (right):

http://codereview.chromium.org/3064012/diff/76001/77010#newcode20
chrome/test/webdriver/commands/webdriver_command.h:20: // browser, such a
transfering a file, inhert from the Command class
excellent; makes things much more clear.

It is unclear to me why you'd want to xfer a file to the webdriver process, but
that isn't relevant here.

Powered by Google App Engine
This is Rietveld 408576698