The webdriver-user-agent gem now supports random user agents

My webdriver-user-agent gem now supports random user agents. This idea belonged to Christoph Pilka who released the webdriver-user-agent-randomizer gem and suggested that we merge this feature back into the orginal gem.

Well, I have done it and now you can access this functionality like so:

require 'selenium-webdriver'
require 'webdriver-user-agent'
driver = UserAgent.driver(:agent => :random)
driver.execute_script('return navigator.userAgent')
# random agent like "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.2) Gecko/20010726 Netscape6/6.1"

See README for full details.

Author: Alister Scott

Alister is an Excellence Wrangler for Automattic.

2 thoughts on “The webdriver-user-agent gem now supports random user agents”

  1. Excellent. Thanks a ton for all of the information you share. It has been really helpful to me and my learning processing in developing a framework for the automation project I work on. FYI: you have a typo in your selenium require statement in the example above.


Comments are closed.