Created
May 18, 2016 19:22
-
-
Save Snarp/6793f344264309c5646dcadceaf14ced to your computer and use it in GitHub Desktop.
Working example of how to load the mobile version of a site using watir-webdriver 0.9.1, selenium-webdriver 2.53.0, webdriver-user-agent 7.4, and Firefox 46.0.1. (Version numbers important because Firefox.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'watir-webdriver' | |
require 'webdriver-user-agent' | |
# Works as of: | |
# - watir-webdriver 0.9.1 | |
# - webdriver-user-agent 7.4 | |
# - selenium-webdriver 2.53.0 | |
# - Firefox 46.0.1 | |
# Creates new Firefox profile to bypass Firefox's chronic profile glitches. | |
profile = Selenium::WebDriver::Firefox::Profile.new | |
profile['browser.startup.homepage_override.mstone'] = 'ignore' | |
profile['startup.homepage_welcome_url.additional'] = 'about:blank' | |
driver = Webdriver::UserAgent.driver(:browser => :firefox, :profile => profile, :agent => :iphone, :orientation => :landscape) | |
browser = Watir::Browser.new driver | |
browser.goto 'tiffany.com' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment