cobrateam/splinter — pull request #126 by flavioribeiro (2012-01-13 17:36:40+00:00)
Title: Add the capability of defining the user agent on Browser initialization

This pull request adds the capability of defining a different user agent to chrome and firefox webdrivers:

>>> from splinter.browser import Browser
>>> b = Browser()
>>> b.visit('http://whatsmyuseragent.com')
>>> b.find_by_xpath("/html/body/center/div/h4")[0].text
u'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:6.0) Gecko/20100101 Firefox/6.0'
>>> b = Browser(user_agent="iPhone")
>>> b.visit('http://whatsmyuseragent.com')
>>> b.find_by_xpath("/html/body/center/div/h4")[0].text
u'iPhone'