webdriver-user-agent icon indicating copy to clipboard operation
webdriver-user-agent copied to clipboard

Setting Safari preferences via defaults write does not seem to work

Open samnissen opened this issue 3 years ago • 0 comments

No fault of the gem, but unfortunately this script will run to the end in Safari 14.0.3 on Big Sur:

`defaults write com.apple.Safari CustomUserAgent \"\\\"Mozilla/5.0 (iPhone; CPU iPhone OS 13_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Mobile/15E148 Safari/604.1\\\"\"`
raise unless `defaults read com.apple.Safari CustomUserAgent` == "Mozilla/5.0 (iPhone; CPU iPhone OS 13_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Mobile/15E148 Safari/604.1\n"
b = Watir::Browser.new :safari
raise if b.execute_script('return navigator.userAgent').include?("iPhone")
b.close

samnissen avatar May 18 '21 20:05 samnissen