Wednesday, February 11, 2009

How to make Selenium use Google Chrome

Google's Chrome web browser was released in September of 2008, and is an increasingly popular browser to use for testing using Selenium. The RC was patched on the day that the web browser was released with a new browser launcher for Chrome. You'll need revision 2408 or later. There is nothing special that one must do to start a Selenium session using Chrome. All you need to do is call the Selenium constructor with the browser type argument of "*googlechrome".

For example:

from selenium import selenium
s = selenium("localhost", "4444", "*googlechrome", "http://www.google.com")
s.start()

Current Bugs:
  • There have been reports that Chrome support for selenium won't work on Windows XP 64-bit.
  • The Google Chrome launcher does not support the avoidProxy option (SRC-524)
  • http://localhost doesn't work as a starting URL in Google Chrome (SRC-529)