Skip to content

Instantly share code, notes, and snippets.

@dariodiaz
Created April 3, 2012 23:45
Show Gist options
  • Save dariodiaz/2296411 to your computer and use it in GitHub Desktop.
Save dariodiaz/2296411 to your computer and use it in GitHub Desktop.
webdriver: Mobile user agent
#------------------------------------------------------------------------------------------------------
# Define Caps
#------------------------------------------------------------------------------------------------------
profile = Selenium::WebDriver::Firefox::Profile.new
profile['general.useragent.override'] = "Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16"
if platform.match(/Firefox/)
caps = Selenium::WebDriver::Remote::Capabilities.firefox(:javascript_enabled => true, :firefox_profile=> profile)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment