webdriver-user-agent 7.2 → 7.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.ruby-version +1 -1
- data/ChangeLog +19 -1
- data/README.md +3 -2
- data/lib/device-info/devices.yaml +144 -35
- data/lib/webdriver-user-agent.rb +14 -13
- data/lib/webdriver-user-agent/browser_options.rb +112 -9
- data/lib/webdriver-user-agent/devices.rb +5 -3
- data/lib/webdriver-user-agent/driver.rb +18 -7
- data/spec/webdriver-user-agent_spec.rb +356 -67
- data/webdriver-user-agent.gemspec +11 -6
- metadata +70 -36
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1f103f486777f7dffc40b6177cbd52c1ed13826daf41c500f8f69f1869e71c6f
|
4
|
+
data.tar.gz: 4844156cef409e1c77d5e4610b3e51e1c995954edc3e0823fd4651255b5372fd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1f297ddcf8064c4c6a37c550f0bf2ea57e4d3ca6cc60856315f9656b15426ca36357173ac87b246dde72d8f9d9f05d929f35aa82ee6f72461d47409556bdfa23
|
7
|
+
data.tar.gz: 69368f91ffb7b262a7b45161dc4099fa80230d4bca0792b7d1baf80d130e1876850a970dce3b79b2dbae926eddd257dcf7a2ca0584a8cf329f27966941c1b978
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-
|
1
|
+
ruby-2.4.1
|
data/ChangeLog
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
=== Version 7.5 / 2017-8-22
|
2
|
+
* Enhancements
|
3
|
+
* Added support for modern iPhone and iPad sizes
|
4
|
+
* Added support for driving Safari and Safari Technology Preview
|
5
|
+
* Updated to use new Watir namespace
|
6
|
+
* Updated to Ruby 2.4.1
|
7
|
+
* Updated Chrome and Firefox options configuration to use new Selenium syntax
|
8
|
+
|
9
|
+
=== Version 7.4 / 2016-1-6
|
10
|
+
* Enhancements
|
11
|
+
* Added support for iPad Pro and iPhone 6/6s (Thanks samnissen)
|
12
|
+
|
13
|
+
=== Version 7.3 / 2015-7-14 (Thanks samnissen)
|
14
|
+
* Enhancements
|
15
|
+
* Allow users to override the browser screensize
|
16
|
+
* Fixes
|
17
|
+
* Removed development puts commands
|
18
|
+
* Chrome no longer rejects using Javascript to rewize the window
|
19
|
+
|
1
20
|
=== Version 7.2 / 2014-12-12
|
2
21
|
* Enhancements
|
3
22
|
* Added iphone 5 and 6 variants (Thanks samnissen)
|
@@ -6,4 +25,3 @@
|
|
6
25
|
=== Version 7.1 / 2014-3-2
|
7
26
|
* Enhancements
|
8
27
|
* Added ipad 7 device support (Thanks Matthwe Fleeger)
|
9
|
-
|
data/README.md
CHANGED
@@ -25,6 +25,7 @@ provides a UserAgent.driver method to return a new web-driver with user agent an
|
|
25
25
|
* :browser
|
26
26
|
* :firefox (default)
|
27
27
|
* :chrome
|
28
|
+
* :safari
|
28
29
|
* :agent
|
29
30
|
* :iphone (default)
|
30
31
|
* :ipad
|
@@ -51,9 +52,9 @@ provides a UserAgent.driver method to return a new web-driver with user agent an
|
|
51
52
|
driver.execute_script('return navigator.userAgent')
|
52
53
|
# random agent like "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.2) Gecko/20010726 Netscape6/6.1"
|
53
54
|
|
54
|
-
### Example using watir
|
55
|
+
### Example using watir
|
55
56
|
|
56
|
-
require 'watir
|
57
|
+
require 'watir'
|
57
58
|
require 'webdriver-user-agent'
|
58
59
|
driver = Webdriver::UserAgent.driver(:browser => :chrome, :agent => :iphone, :orientation => :landscape)
|
59
60
|
browser = Watir::Browser.new(driver)
|
@@ -1,64 +1,173 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# Desktop size sources
|
2
|
+
# - http://www.hobo-web.co.uk/best-screen-size/
|
3
|
+
# - https://en.wikipedia.org/wiki/Display_resolution#Common_display_resolutions
|
4
|
+
# - http://www.w3schools.com/browsers/browsers_display.asp
|
5
|
+
|
6
|
+
# iPhone and iPad data added by running Simulator on macOS and visiting
|
7
|
+
# https://whatismyviewport.com and
|
8
|
+
# https://www.whatismybrowser.com/detect/what-is-my-user-agent
|
9
|
+
|
10
|
+
# Android user agents and viewports from current android device specs.
|
11
|
+
# Tablet: Samsung Galaxy Tab S6; Phone: Google Pixel 4
|
12
|
+
# Determined without a simulator to account for software chrome,
|
13
|
+
# so these figures are necessarily larger than what will be true
|
14
|
+
# on those devices. Please feel free to submit a pull request
|
15
|
+
# with corrected and/or expanded device values.
|
16
|
+
:desktop:
|
17
|
+
:user_agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1 Safari/605.1.15
|
3
18
|
:portrait:
|
4
|
-
:width:
|
5
|
-
:height:
|
19
|
+
:width: 768
|
20
|
+
:height: 1024
|
6
21
|
:landscape:
|
7
|
-
:width:
|
8
|
-
:height:
|
9
|
-
:
|
10
|
-
|
22
|
+
:width: 1366
|
23
|
+
:height: 768
|
24
|
+
:iphone_default: &iphone_default
|
25
|
+
:user_agent: 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
|
26
|
+
:portrait:
|
27
|
+
:width: 414
|
28
|
+
:height: 719
|
29
|
+
:landscape:
|
30
|
+
:width: 808
|
31
|
+
:height: 414
|
32
|
+
:iphone: &iphone
|
33
|
+
<<: *iphone_default
|
34
|
+
:iphone11pro:
|
35
|
+
<<: *iphone_default
|
11
36
|
:portrait:
|
12
|
-
:width:
|
13
|
-
:height:
|
37
|
+
:width: 375
|
38
|
+
:height: 635
|
14
39
|
:landscape:
|
15
|
-
:width:
|
16
|
-
:height:
|
17
|
-
:
|
18
|
-
|
40
|
+
:width: 724
|
41
|
+
:height: 375
|
42
|
+
:iphone11promax:
|
43
|
+
<<: *iphone_default
|
44
|
+
:iphone11:
|
45
|
+
<<: *iphone_default
|
46
|
+
:iphonese: &iphonese
|
47
|
+
<<: *iphone_default
|
19
48
|
:portrait:
|
20
49
|
:width: 375
|
21
|
-
:height:
|
50
|
+
:height: 553
|
22
51
|
:landscape:
|
23
52
|
:width: 667
|
24
53
|
:height: 375
|
25
|
-
:
|
26
|
-
|
54
|
+
:iphonexr: &iphonexr
|
55
|
+
<<: *iphone_default
|
56
|
+
:iphonexsmax:
|
57
|
+
<<: *iphonexr
|
58
|
+
:iphonexs: &iphonexs
|
59
|
+
<<: *iphone_default
|
60
|
+
:portrait:
|
61
|
+
:width: 375
|
62
|
+
:height: 635
|
63
|
+
:landscape:
|
64
|
+
:width: 724
|
65
|
+
:height: 375
|
66
|
+
:iphonex:
|
67
|
+
<<: *iphonexs
|
68
|
+
:iphone8plus: &iphone8plus
|
69
|
+
<<: *iphone_default
|
70
|
+
:portrait:
|
71
|
+
:width: 414
|
72
|
+
:height: 622
|
73
|
+
:landscape:
|
74
|
+
:width: 736
|
75
|
+
:height: 414
|
76
|
+
:iphone8: &iphone8
|
77
|
+
<<: *iphonese
|
78
|
+
:iphone7plus:
|
79
|
+
<<: *iphone8plus
|
80
|
+
:iphone7:
|
81
|
+
<<: *iphone8
|
82
|
+
:iphone6splus:
|
83
|
+
<<: *iphone8plus
|
84
|
+
:iphone6s:
|
85
|
+
<<: *iphone8
|
86
|
+
:iphone6plus:
|
87
|
+
<<: *iphone8plus
|
88
|
+
:iphone6:
|
89
|
+
<<: *iphone8
|
90
|
+
:iphone5s: &iphone5s
|
91
|
+
<<: *iphone_default
|
27
92
|
:portrait:
|
28
93
|
:width: 320
|
29
|
-
:height:
|
94
|
+
:height: 454
|
30
95
|
:landscape:
|
31
96
|
:width: 568
|
32
|
-
:height:
|
33
|
-
:
|
34
|
-
|
97
|
+
:height: 320
|
98
|
+
:iphonese_old:
|
99
|
+
<<: *iphone5s
|
100
|
+
:iphone5:
|
101
|
+
<<: *iphone5s
|
102
|
+
:iphone4s: &iphone4s
|
103
|
+
<<: *iphone_default
|
35
104
|
:portrait:
|
36
105
|
:width: 320
|
37
106
|
:height: 356
|
38
107
|
:landscape:
|
39
108
|
:width: 480
|
40
109
|
:height: 196
|
41
|
-
:
|
42
|
-
|
110
|
+
:iphone4:
|
111
|
+
<<: *iphone4s
|
112
|
+
:ipad: &ipad
|
113
|
+
:user_agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Safari/605.1.15
|
114
|
+
:portrait:
|
115
|
+
:width: 810
|
116
|
+
:height: 1010
|
117
|
+
:landscape:
|
118
|
+
:width: 1080
|
119
|
+
:height: 740
|
120
|
+
:ipad_default:
|
121
|
+
<<: *ipad
|
122
|
+
:ipad_pro: &ipad_pro
|
123
|
+
<<: *ipad
|
124
|
+
:portrait:
|
125
|
+
:width: 1024
|
126
|
+
:height: 1292
|
127
|
+
:landscape:
|
128
|
+
:width: 1366
|
129
|
+
:height: 950
|
130
|
+
:ipad_pro_12:
|
131
|
+
<<: *ipad_pro
|
132
|
+
:ipad_pro_11:
|
133
|
+
<<: *ipad
|
134
|
+
:portrait:
|
135
|
+
:width: 834
|
136
|
+
:height: 1120
|
137
|
+
:landscape:
|
138
|
+
:width: 1194
|
139
|
+
:height: 760
|
140
|
+
:ipad_pro_9:
|
141
|
+
<<: *ipad
|
43
142
|
:portrait:
|
44
143
|
:width: 768
|
45
|
-
:height:
|
144
|
+
:height: 954
|
46
145
|
:landscape:
|
47
146
|
:width: 1024
|
48
|
-
:height:
|
147
|
+
:height: 698
|
148
|
+
:ipad_air: &ipad_air
|
149
|
+
<<: *ipad
|
150
|
+
:portrait:
|
151
|
+
:width: 834
|
152
|
+
:height: 1038
|
153
|
+
:landscape:
|
154
|
+
:width: 1112
|
155
|
+
:height: 760
|
156
|
+
:ipad_pro_10:
|
157
|
+
<<: *ipad_air
|
49
158
|
:android_phone:
|
50
|
-
:user_agent:
|
159
|
+
:user_agent: Mozilla/5.0 (Linux; Android 10; Pixel) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.87 Mobile Safari/537.36
|
51
160
|
:portrait:
|
52
|
-
:width:
|
53
|
-
:height:
|
161
|
+
:width: 411
|
162
|
+
:height: 869
|
54
163
|
:landscape:
|
55
|
-
:width:
|
56
|
-
:height:
|
164
|
+
:width: 869
|
165
|
+
:height: 411
|
57
166
|
:android_tablet:
|
58
|
-
:user_agent:
|
167
|
+
:user_agent: Mozilla/5.0 (Linux; Android 9; SAMSUNG SM-T865) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/10.1 Chrome/71.0.3578.99 Safari/537.36
|
59
168
|
:portrait:
|
60
|
-
:width:
|
61
|
-
:height:
|
169
|
+
:width: 800
|
170
|
+
:height: 1280
|
62
171
|
:landscape:
|
63
|
-
:width:
|
64
|
-
:height:
|
172
|
+
:width: 1280
|
173
|
+
:height: 800
|
data/lib/webdriver-user-agent.rb
CHANGED
@@ -3,21 +3,22 @@ require 'webdriver-user-agent/driver'
|
|
3
3
|
|
4
4
|
module Webdriver
|
5
5
|
module UserAgent
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
class << self
|
7
|
+
def driver(options = {})
|
8
|
+
Driver.instance.for options
|
9
|
+
end
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
def devices
|
12
|
+
Driver.instance.devices
|
13
|
+
end
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
def self.agent_string_for device
|
19
|
-
Driver.instance.agent_string_for device
|
20
|
-
end
|
15
|
+
def resolution_for(device_name, orientation)
|
16
|
+
Driver.instance.resolution_for device_name, orientation
|
17
|
+
end
|
21
18
|
|
19
|
+
def agent_string_for(device)
|
20
|
+
Driver.instance.agent_string_for device
|
21
|
+
end
|
22
|
+
end
|
22
23
|
end
|
23
24
|
end
|
@@ -2,6 +2,12 @@ require 'facets/hash/except'
|
|
2
2
|
|
3
3
|
module Webdriver
|
4
4
|
module UserAgent
|
5
|
+
|
6
|
+
MINIMUM_MACOS_VERSION_NUMBER = 12
|
7
|
+
DEFAULT_BROWSER = :firefox
|
8
|
+
DEFAULT_AGENT = :iphone
|
9
|
+
DEFAULT_ORIENTATION = :portrait
|
10
|
+
|
5
11
|
class BrowserOptions
|
6
12
|
|
7
13
|
def initialize(opts, user_agent_string)
|
@@ -9,7 +15,11 @@ module Webdriver
|
|
9
15
|
options[:browser] ||= :firefox
|
10
16
|
options[:agent] ||= :iphone
|
11
17
|
options[:orientation] ||= :portrait
|
12
|
-
|
18
|
+
set_preview_option(options[:safari_technology_preview]) if (@options[:browser] == :safari)
|
19
|
+
|
20
|
+
options[:viewport_width], options[:viewport_height] = parse_viewport_sizes(options[:viewport_width], options[:viewport_height])
|
21
|
+
|
22
|
+
initialize_for_browser(user_agent_string, opts[:accept_language_string], opts[:options])
|
13
23
|
end
|
14
24
|
|
15
25
|
def method_missing(*args, &block)
|
@@ -20,7 +30,7 @@ module Webdriver
|
|
20
30
|
end
|
21
31
|
|
22
32
|
def browser_options
|
23
|
-
options.except(:browser, :agent, :orientation, :user_agent_string)
|
33
|
+
options.except(:browser, :agent, :orientation, :user_agent_string, :accept_language_string, :viewport_width, :viewport_height, :safari_technology_preview)
|
24
34
|
end
|
25
35
|
|
26
36
|
private
|
@@ -29,19 +39,112 @@ module Webdriver
|
|
29
39
|
@options ||= {}
|
30
40
|
end
|
31
41
|
|
32
|
-
def
|
42
|
+
def set_preview_option(opt)
|
43
|
+
@stp = opt
|
44
|
+
@stp = false unless @stp.is_a?(TrueClass)
|
45
|
+
end
|
46
|
+
|
47
|
+
def initialize_for_browser(user_agent_string, accept_language_string, driver_options = nil)
|
48
|
+
options[:options] ||= driver_options
|
49
|
+
|
33
50
|
case options[:browser]
|
34
51
|
when :firefox
|
35
|
-
options[:
|
36
|
-
|
52
|
+
options[:options] ||= Selenium::WebDriver::Firefox::Options.new
|
53
|
+
|
54
|
+
profile ||= options[:options].profile || Selenium::WebDriver::Firefox::Profile.new
|
55
|
+
set_keys = profile.instance_variable_get(:@additional_prefs).keys
|
56
|
+
|
57
|
+
profile['general.useragent.override'] = user_agent_string if !set_keys.include?('general.useragent.override')
|
58
|
+
profile['intl.accept_languages'] = accept_language_string if accept_language_string && !set_keys.include?('intl.accept_languages')
|
59
|
+
|
60
|
+
options[:options].profile = profile
|
37
61
|
when :chrome
|
38
|
-
options[:
|
39
|
-
|
62
|
+
options[:options] ||= Selenium::WebDriver::Chrome::Options.new
|
63
|
+
|
64
|
+
set_args = options[:options].args.map{|s| "#{s}"}.join(" ")
|
65
|
+
options[:options].add_argument "--user-agent=#{user_agent_string}" if !set_args.include?("--user-agent=")
|
66
|
+
|
67
|
+
set_prefs = options[:options].prefs.keys
|
68
|
+
options[:options].add_preference("intl.accept_languages", accept_language_string) if accept_language_string && !set_prefs.include?("intl.accept_languages")
|
69
|
+
when :safari
|
70
|
+
options[:options] ||= Selenium::WebDriver::Safari::Options.new
|
71
|
+
change_safari_user_agent_string(user_agent_string)
|
72
|
+
change_safari_language(accept_language_string) if accept_language_string
|
40
73
|
else
|
41
|
-
raise "WebDriver UserAgent currently only supports :firefox and :
|
74
|
+
raise "WebDriver UserAgent currently only supports :chrome, :firefox and :safari."
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def parse_viewport_sizes(width, height)
|
79
|
+
return ["0","0"] unless "#{width}".to_i > 0 && "#{height}".to_i > 0
|
80
|
+
|
81
|
+
["#{width}", "#{height}"]
|
82
|
+
end
|
83
|
+
|
84
|
+
def change_safari_user_agent_string(user_agent_string)
|
85
|
+
ua = "\"\\\"#{user_agent_string}\\\"\"" # escape for shell quoting
|
86
|
+
|
87
|
+
safari_command_runner(ua, "CustomUserAgent")
|
88
|
+
end
|
89
|
+
|
90
|
+
def change_safari_language(accept_language_string)
|
91
|
+
parsed_safari_string = prepare_safari_string(accept_language_string)
|
92
|
+
|
93
|
+
safari_command_runner(parsed_safari_string, "AppleLanguages")
|
94
|
+
end
|
95
|
+
|
96
|
+
def safari_command_runner(setting, pref)
|
97
|
+
raise "Safari requires a Mac" unless OS.mac?
|
98
|
+
|
99
|
+
cmd = "defaults write com.apple.#{safari_version} #{pref} #{setting}"
|
100
|
+
output = `#{cmd}`
|
101
|
+
|
102
|
+
raise prepare_safari_error_message(cmd, output) unless safari_command_success?(setting, safari_version, pref, $?)
|
103
|
+
end
|
104
|
+
|
105
|
+
def safari_command_success?(setting, safari_version, pref, result)
|
106
|
+
setting_chars = "#{setting}".gsub(/\W/, '')
|
107
|
+
read_chars = `defaults read com.apple.#{safari_version} #{pref}`.gsub(/\W/, '')
|
108
|
+
|
109
|
+
setting_match = (setting_chars == read_chars)
|
110
|
+
setting_match && result.success?
|
111
|
+
end
|
112
|
+
|
113
|
+
def safari_version
|
114
|
+
if @stp
|
115
|
+
Selenium::WebDriver::Safari.technology_preview!
|
116
|
+
return "SafariTechnologyPreview"
|
42
117
|
end
|
43
|
-
|
118
|
+
|
119
|
+
"Safari"
|
44
120
|
end
|
121
|
+
|
122
|
+
def prepare_safari_error_message(cmd, output)
|
123
|
+
error_message = "Unable to execute '#{cmd}'. "
|
124
|
+
error_message += "Error message reported: '#{output}'"
|
125
|
+
error_message += "Please execute the command manually and correct any errors."
|
126
|
+
|
127
|
+
error_message
|
128
|
+
end
|
129
|
+
|
130
|
+
def prepare_safari_string(accept_language_string)
|
131
|
+
["'(", accept_language_string.split(",").map{|l|
|
132
|
+
"\"#{l.gsub(/\s+/,'')}\""
|
133
|
+
}.join(", "), ")'"].join('')
|
134
|
+
end
|
135
|
+
|
136
|
+
# Require a Mac at version 12 (Sierra) or greater
|
137
|
+
def require_mac_version
|
138
|
+
raise "Safari requires a Mac" unless OS.mac?
|
139
|
+
raise "Selenium only works with Safari on Sierra or newer" unless valid_mac_version?
|
140
|
+
end
|
141
|
+
|
142
|
+
def valid_mac_version?
|
143
|
+
version = "#{`defaults read loginwindow SystemVersionStampAsString`}"
|
144
|
+
version_number = "#{version.split(".")[1]}"
|
145
|
+
version_number.to_i >= MINIMUM_MACOS_VERSION_NUMBER
|
146
|
+
end
|
147
|
+
|
45
148
|
end
|
46
149
|
end
|
47
150
|
end
|
@@ -3,12 +3,14 @@ require 'yaml'
|
|
3
3
|
module Webdriver
|
4
4
|
module UserAgent
|
5
5
|
module Devices
|
6
|
-
|
6
|
+
|
7
7
|
def devices
|
8
8
|
YAML.load_file devices_file
|
9
9
|
end
|
10
10
|
|
11
|
-
def resolution_for(device_name, orientation)
|
11
|
+
def resolution_for(device_name, orientation, user_width, user_height)
|
12
|
+
return [user_width.to_i, user_height.to_i] if ((user_width.to_i + user_height.to_i) > 1)
|
13
|
+
|
12
14
|
device = devices[device_name.downcase][orientation.downcase]
|
13
15
|
[device[:width],device[:height]]
|
14
16
|
end
|
@@ -21,7 +23,7 @@ module Webdriver
|
|
21
23
|
end
|
22
24
|
|
23
25
|
private
|
24
|
-
|
26
|
+
|
25
27
|
def random_user_agent
|
26
28
|
File.foreach(user_agents_file).each_with_index.reduce(nil) do |picked,pair|
|
27
29
|
rand < 1.0/(1+pair[1]) ? pair[0] : picked
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'json'
|
2
|
+
require 'os'
|
2
3
|
require 'selenium-webdriver'
|
3
4
|
require 'webdriver-user-agent/browser_options'
|
4
5
|
require 'webdriver-user-agent/devices'
|
@@ -14,27 +15,37 @@ module Webdriver
|
|
14
15
|
user_agent_string ||= agent_string_for opts[:agent]
|
15
16
|
options = BrowserOptions.new(opts, user_agent_string)
|
16
17
|
build_driver_using options
|
18
|
+
ensure
|
19
|
+
if safari?(opts)
|
20
|
+
case
|
21
|
+
when opts[:safari_technology_preview].is_a?(TrueClass)
|
22
|
+
`defaults delete com.apple.SafariTechnologyPreview CustomUserAgent`
|
23
|
+
`defaults delete com.apple.SafariTechnologyPreview AppleLanguages`
|
24
|
+
else
|
25
|
+
`defaults delete com.apple.Safari CustomUserAgent`
|
26
|
+
`defaults delete com.apple.Safari AppleLanguages`
|
27
|
+
end
|
28
|
+
end
|
17
29
|
end
|
18
30
|
|
19
31
|
private
|
20
32
|
|
21
33
|
def resize_inner_window(driver, width, height)
|
22
|
-
|
23
|
-
|
24
|
-
driver.close
|
25
|
-
driver.switch_to.window driver.window_handles.first
|
26
|
-
end
|
27
|
-
driver.execute_script("window.innerWidth = #{width}; window.innerHeight = #{height};")
|
34
|
+
target_size = Selenium::WebDriver::Dimension.new(width.to_i, height.to_i)
|
35
|
+
driver.manage.window.resize_to target_size.width, target_size.height
|
28
36
|
end
|
29
37
|
|
30
38
|
def build_driver_using(options)
|
31
39
|
driver = Selenium::WebDriver.for options.browser, options.browser_options
|
32
40
|
unless options.agent == :random
|
33
|
-
resize_inner_window(driver, *resolution_for(options.agent, options.orientation))
|
41
|
+
resize_inner_window(driver, *resolution_for(options.agent, options.orientation, options.viewport_width, options.viewport_height))
|
34
42
|
end
|
35
43
|
driver
|
36
44
|
end
|
37
45
|
|
46
|
+
def safari?(o = {})
|
47
|
+
o[:browser] == :safari
|
48
|
+
end
|
38
49
|
end
|
39
50
|
end
|
40
51
|
end
|
@@ -4,96 +4,385 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
4
4
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
5
5
|
require 'webdriver-user-agent'
|
6
6
|
require 'selenium-webdriver'
|
7
|
-
require 'watir
|
7
|
+
require 'watir'
|
8
|
+
require 'webdrivers'
|
9
|
+
|
10
|
+
CHROMEBROWSER_UICHROME_HEIGHT = 123
|
11
|
+
CHROMEBROWSER_UICHROME_HEIGHT_TALL = 50
|
12
|
+
CHROMEBROWSER_UI_MINIMUM_HEIGHT = 289
|
13
|
+
FIREFOXBROWSER_UICHROME_HEIGHT = 74
|
14
|
+
FIREFOXBROWSER_MINIMUM_WIDTH = 450
|
15
|
+
SAFARIBROWSER_UICHROME_HEIGHT = 38
|
16
|
+
|
17
|
+
RSpec.shared_examples "browser driver" do
|
18
|
+
it "creates the browser driver" do
|
19
|
+
expect("#{driver.browser}").to match(/#{Regexp.quote(browser.to_s)}/i)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "matches the agent partial" do
|
23
|
+
expect(driver.execute_script(agent_script)).to include agent_match
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
RSpec.shared_examples "random browser driver" do
|
28
|
+
it "creates the browser driver" do
|
29
|
+
expect("#{driver.browser}").to match(/#{Regexp.quote(browser.to_s)}/i)
|
30
|
+
end
|
31
|
+
|
32
|
+
it "matches the agent partial" do
|
33
|
+
expect(driver.execute_script(agent_script)).not_to be_nil
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
RSpec.shared_examples "firefox size" do
|
38
|
+
it "matches the expected width" do
|
39
|
+
width_expectation = device.dig(orientation, :width)
|
40
|
+
width_expectation = FIREFOXBROWSER_MINIMUM_WIDTH if width_expectation < FIREFOXBROWSER_MINIMUM_WIDTH
|
41
|
+
expect(driver.execute_script(width_script)).to eq(width_expectation)
|
42
|
+
end
|
43
|
+
|
44
|
+
it "matches the expected height" do
|
45
|
+
height_expectation = device.dig(orientation, :height) - FIREFOXBROWSER_UICHROME_HEIGHT
|
46
|
+
expect(driver.execute_script(height_script)).to eq(height_expectation)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
RSpec.shared_examples "safari size" do
|
51
|
+
it "matches the expected width" do
|
52
|
+
width_expectation = device.dig(orientation, :width)
|
53
|
+
expect(driver.execute_script(width_script)).to eq(width_expectation)
|
54
|
+
end
|
55
|
+
|
56
|
+
it "matches the expected height" do
|
57
|
+
height_expectation = device.dig(orientation, :height) - SAFARIBROWSER_UICHROME_HEIGHT
|
58
|
+
expect(driver.execute_script(height_script)).to eq(height_expectation)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
RSpec.shared_examples "chrome size" do
|
63
|
+
it "matches the expected width" do
|
64
|
+
width_expectation = device.dig(orientation, :width)
|
65
|
+
expect(driver.execute_script(width_script)).to eq(width_expectation)
|
66
|
+
end
|
67
|
+
|
68
|
+
it "matches the expected height" do
|
69
|
+
height_expectation = device.dig(orientation, :height) - CHROMEBROWSER_UICHROME_HEIGHT
|
70
|
+
expect(driver.execute_script(height_script)).to eq(height_expectation)
|
71
|
+
end
|
72
|
+
end
|
8
73
|
|
9
74
|
describe "webdriver user agent" do
|
75
|
+
let(:devices) { Webdriver::UserAgent.devices }
|
76
|
+
let(:agent_script) { 'return navigator.userAgent' }
|
77
|
+
let(:width_script) { 'return Math.max(document.documentElement.clientWidth, window.innerWidth || 0)' }
|
78
|
+
let(:height_script) { 'return Math.max(document.documentElement.clientHeight, window.innerHeight || 0)' }
|
79
|
+
|
10
80
|
after :each do
|
11
|
-
|
81
|
+
driver.quit if defined?(driver)
|
82
|
+
browser.close if defined?(browser) && browser&.is_a?(Watir::Browser)
|
83
|
+
sleep(0.5) # Safari needs time to shutdown
|
84
|
+
end
|
85
|
+
|
86
|
+
# window.innerWidth and window.innerHeight
|
87
|
+
# do not accurately provide
|
88
|
+
# browser widths and heights
|
89
|
+
# http://stackoverflow.com/a/8876069/1651458
|
90
|
+
|
91
|
+
context "no browser, agent or orientation set" do
|
92
|
+
let(:device) { devices[:iphone] }
|
93
|
+
let(:driver) { Webdriver::UserAgent.driver }
|
94
|
+
let(:browser) { "firefox" }
|
95
|
+
let(:orientation) { :portrait }
|
96
|
+
let(:agent_match) { 'iPhone' }
|
97
|
+
|
98
|
+
it_behaves_like "browser driver"
|
99
|
+
it_behaves_like "firefox size"
|
12
100
|
end
|
13
101
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
102
|
+
context "Safari browser, iPhone 11 Pro Max agent, landscape orientation" do
|
103
|
+
let(:device) { devices[:iphone11promax] }
|
104
|
+
let(:orientation) { :landscape }
|
105
|
+
let(:driver) do
|
106
|
+
# Safari is a mess. safari_technology_preview added because
|
107
|
+
# Safari just isn't working in my environment as of 13.1 - Sam
|
108
|
+
|
109
|
+
Webdriver::UserAgent.driver(
|
110
|
+
browser: :safari,
|
111
|
+
agent: :iphone11promax,
|
112
|
+
orientation: orientation,
|
113
|
+
safari_technology_preview: true
|
114
|
+
)
|
115
|
+
end
|
116
|
+
let(:browser) { "safari" }
|
117
|
+
let(:orientation) { :landscape }
|
118
|
+
let(:agent_match) { 'iPhone' }
|
119
|
+
|
120
|
+
it_behaves_like "browser driver"
|
121
|
+
it_behaves_like "safari size"
|
20
122
|
end
|
21
123
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
124
|
+
context "Safari browser, iPhone 6 Plus agent, landscape orientation" do
|
125
|
+
let(:device) { devices[:iphone6plus] }
|
126
|
+
let(:orientation) { :landscape }
|
127
|
+
let(:driver) do
|
128
|
+
# Safari is a mess. safari_technology_preview added because
|
129
|
+
# Safari just isn't working in my environment as of 13.1 - Sam
|
130
|
+
|
131
|
+
Webdriver::UserAgent.driver(
|
132
|
+
browser: :safari,
|
133
|
+
agent: :iphone6plus,
|
134
|
+
orientation: orientation,
|
135
|
+
safari_technology_preview: true
|
136
|
+
)
|
137
|
+
end
|
138
|
+
let(:browser) { "safari" }
|
139
|
+
let(:agent_match) { 'iPhone' }
|
140
|
+
|
141
|
+
it_behaves_like "browser driver"
|
142
|
+
it_behaves_like "safari size"
|
28
143
|
end
|
29
144
|
|
30
|
-
|
31
|
-
|
145
|
+
context "Chrome browser, iPhone XS agent, landscape orientation" do
|
146
|
+
let(:device_key) { :iphonexs }
|
147
|
+
let(:device) { devices[device_key] }
|
148
|
+
let(:orientation) { :landscape }
|
149
|
+
let(:driver) do
|
150
|
+
Webdriver::UserAgent.driver(
|
151
|
+
browser: :chrome,
|
152
|
+
agent: device_key,
|
153
|
+
orientation: orientation
|
154
|
+
)
|
155
|
+
end
|
156
|
+
let(:browser) { "chrome" }
|
157
|
+
let(:agent_match) { 'iPhone' }
|
158
|
+
|
159
|
+
it_behaves_like "browser driver"
|
160
|
+
it_behaves_like "chrome size"
|
161
|
+
end
|
162
|
+
|
163
|
+
context "Chrome browser, iPhone XS agent, landscape orientation" do
|
164
|
+
let(:device_key) { :ipad }
|
165
|
+
let(:device) { devices[device_key] }
|
166
|
+
let(:orientation) { :landscape }
|
167
|
+
let(:driver) do
|
168
|
+
Webdriver::UserAgent.driver(
|
169
|
+
browser: :chrome,
|
170
|
+
agent: device_key,
|
171
|
+
orientation: orientation
|
172
|
+
)
|
173
|
+
end
|
174
|
+
let(:browser) { "chrome" }
|
175
|
+
let(:agent_match) { 'Mac OS' }
|
176
|
+
|
177
|
+
it_behaves_like "browser driver"
|
178
|
+
it_behaves_like "chrome size"
|
179
|
+
end
|
180
|
+
|
181
|
+
it "can create a new webdriver driver using chrome and iPad Pro (portrait)" do
|
182
|
+
# Testing the height will fail if your monitor is not tall enough.
|
183
|
+
# For instance, a 15" MacBook Pro at default scaled resolution cannot be.
|
184
|
+
# This will determine if your monitor is tall enough.
|
185
|
+
# Optionally, you can override with an environment variable:
|
186
|
+
# `I_HAVE_A_TALL_MONITOR=true rspec spec/this_file.rb`
|
187
|
+
width = 800; height = 1302
|
188
|
+
@driver = Webdriver::UserAgent.driver(:viewport_width => "#{width}", :viewport_height => height, :agent => :desktop)
|
189
|
+
browser_max_height = @driver.execute_script('return Math.max(document.documentElement.clientHeight, window.innerHeight || 0)')
|
190
|
+
@you_have_a_tall_monitor = (browser_max_height > (1302 - CHROMEBROWSER_UICHROME_HEIGHT))
|
191
|
+
@you_have_a_tall_monitor = true if ("#{ENV['I_HAVE_A_TALL_MONITOR']}".downcase == 'true')
|
192
|
+
@driver.quit if @driver
|
193
|
+
# Back to your regularly scheduled test.
|
194
|
+
|
195
|
+
@driver = Webdriver::UserAgent.driver(:browser => :chrome, :agent => :ipad_pro, :orientation => :portrait)
|
32
196
|
expect(@driver.browser).to eq(:chrome)
|
33
|
-
expect(@driver.execute_script('return navigator.userAgent')).to include '
|
34
|
-
expect(@driver.execute_script('return window.innerWidth')).to eq(1024)
|
35
|
-
|
197
|
+
expect(@driver.execute_script('return navigator.userAgent')).to include 'Mac OS'
|
198
|
+
expect(@driver.execute_script('return Math.max(document.documentElement.clientWidth, window.innerWidth || 0)')).to eq(1024)
|
199
|
+
|
200
|
+
# See above
|
201
|
+
if @you_have_a_tall_monitor
|
202
|
+
expect(@driver.execute_script('return Math.max(document.documentElement.clientHeight, window.innerHeight || 0)')).to eq(1302 - CHROMEBROWSER_UICHROME_HEIGHT)
|
203
|
+
end
|
36
204
|
end
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
205
|
+
|
206
|
+
context "Chrome browser, Android tablet agent, landscape orientation" do
|
207
|
+
let(:device_key) { :android_tablet }
|
208
|
+
let(:device) { devices[device_key] }
|
209
|
+
let(:orientation) { :landscape }
|
210
|
+
let(:driver) do
|
211
|
+
Webdriver::UserAgent.driver(
|
212
|
+
browser: :chrome,
|
213
|
+
agent: device_key,
|
214
|
+
orientation: orientation
|
215
|
+
)
|
216
|
+
end
|
217
|
+
let(:browser) { "chrome" }
|
218
|
+
let(:agent_match) { 'Android' }
|
219
|
+
|
220
|
+
it_behaves_like "browser driver"
|
221
|
+
it_behaves_like "chrome size"
|
44
222
|
end
|
45
223
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
224
|
+
context "Firefox browser, desktop agent, landscape orientation" do
|
225
|
+
let(:device_key) { :desktop }
|
226
|
+
let(:device) { devices[device_key] }
|
227
|
+
let(:orientation) { :landscape }
|
228
|
+
let(:driver) do
|
229
|
+
Webdriver::UserAgent.driver(
|
230
|
+
browser: :firefox,
|
231
|
+
agent: device_key,
|
232
|
+
orientation: orientation
|
233
|
+
)
|
234
|
+
end
|
235
|
+
let(:browser) { "firefox" }
|
236
|
+
let(:agent_match) { 'Mac OS' }
|
237
|
+
|
238
|
+
it_behaves_like "browser driver"
|
239
|
+
it_behaves_like "firefox size"
|
52
240
|
end
|
53
241
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
242
|
+
context "random agent" do
|
243
|
+
context "no specified browser" do
|
244
|
+
let(:device_key) { :random }
|
245
|
+
let(:driver) { Webdriver::UserAgent.driver(agent: device_key) }
|
246
|
+
let(:browser) { :firefox }
|
247
|
+
|
248
|
+
it_behaves_like "random browser driver"
|
249
|
+
end
|
250
|
+
|
251
|
+
context "chrome browser" do
|
252
|
+
let(:device_key) { :random }
|
253
|
+
let(:browser) { :chrome }
|
254
|
+
let(:driver) do
|
255
|
+
Webdriver::UserAgent.driver(browser: browser, agent: device_key)
|
256
|
+
end
|
257
|
+
|
258
|
+
it_behaves_like "random browser driver"
|
259
|
+
end
|
60
260
|
end
|
61
261
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
262
|
+
context "existing firefox profile" do
|
263
|
+
let(:device) { devices[:iphone] }
|
264
|
+
let(:profile) do
|
265
|
+
profile = Selenium::WebDriver::Firefox::Profile.new
|
266
|
+
profile["intl.accept_languages"] = "es-MX"
|
267
|
+
profile
|
268
|
+
end
|
269
|
+
let(:options) { Selenium::WebDriver::Firefox::Options.new(profile: profile) }
|
270
|
+
let(:browser) { :firefox }
|
271
|
+
let(:agent_match) { 'iPhone' }
|
272
|
+
let(:orientation) { :portrait }
|
273
|
+
let(:driver) { Webdriver::UserAgent.driver(browser: browser, options: options) }
|
274
|
+
|
275
|
+
it_behaves_like "browser driver"
|
276
|
+
it_behaves_like "firefox size"
|
277
|
+
|
278
|
+
it "absorbs the options' profile" do
|
279
|
+
expect(driver.execute_script("return (navigator.language || navigator.userLanguage)")).to include("es-MX")
|
280
|
+
end
|
68
281
|
end
|
69
282
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
283
|
+
context "user-provided user agent string for firefox" do
|
284
|
+
let(:browser) { :firefox }
|
285
|
+
let(:user_agent) { "Mozilla/4.0 (compatible; MSIE 5.5b1; Mac_PowerPC)" }
|
286
|
+
let(:driver) { Webdriver::UserAgent.driver(user_agent_string: user_agent) }
|
287
|
+
|
288
|
+
it "can create a new webdriver driver" do
|
289
|
+
expect("#{driver.browser}").to match(/#{Regexp.quote(browser.to_s)}/i)
|
290
|
+
|
291
|
+
expect(driver.execute_script("return navigator.userAgent")).to include("Mac_PowerPC")
|
292
|
+
end
|
79
293
|
end
|
80
|
-
|
81
|
-
it "can create a new webdriver driver using firefox and user-specified user agent" do
|
82
|
-
@driver = Webdriver::UserAgent.driver(:user_agent_string => "Mozilla/4.0 (compatible; MSIE 5.5b1; Mac_PowerPC)")
|
83
|
-
expect(@driver.browser).to eq(:firefox)
|
84
|
-
expect(@driver.execute_script('return navigator.userAgent')).not_to be_nil
|
85
|
-
|
86
|
-
@browser = Watir::Browser.new @driver
|
87
|
-
expect(@browser.url).to eq("about:blank")
|
88
|
-
end
|
89
294
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
295
|
+
context "user-provided accept language string for firefox" do
|
296
|
+
let(:browser) { :firefox }
|
297
|
+
let(:language) { "es-ES, es-MX;q=0.9, es;q=0.5, *;0.4" }
|
298
|
+
let(:driver) { Webdriver::UserAgent.driver(accept_language_string: language) }
|
299
|
+
|
300
|
+
it "can create a new webdriver driver" do
|
301
|
+
expect("#{driver.browser}").to match(/#{Regexp.quote(browser.to_s)}/i)
|
302
|
+
|
303
|
+
expect(driver.execute_script("return (navigator.language || navigator.userLanguage)")).to include("es-ES")
|
304
|
+
end
|
94
305
|
end
|
95
306
|
|
307
|
+
context "user-provided accept language string for safari" do
|
308
|
+
let(:browser) { :safari }
|
309
|
+
let(:language) { "es-ES, es-MX;q=0.9, es;q=0.5, *;0.4" }
|
310
|
+
let(:driver) {
|
311
|
+
Webdriver::UserAgent.driver(
|
312
|
+
browser: browser,
|
313
|
+
accept_language_string: language,
|
314
|
+
safari_technology_preview: true
|
315
|
+
)
|
316
|
+
}
|
317
|
+
|
318
|
+
it "can create a new webdriver driver" do
|
319
|
+
expect("#{driver.browser}").to match(/#{Regexp.quote(browser.to_s)}/i)
|
96
320
|
|
321
|
+
expect(driver.execute_script("return (navigator.language || navigator.userLanguage)")).to include("es-es")
|
322
|
+
end
|
323
|
+
end
|
97
324
|
|
325
|
+
context "user-provided viewport size and agent for firefox" do
|
326
|
+
let(:browser) { :firefox }
|
327
|
+
let(:device_key) { :iphone11 }
|
328
|
+
let(:device) { devices[device_key] }
|
329
|
+
let(:width) { 800 }
|
330
|
+
let(:height) { 600 }
|
331
|
+
let(:agent_match) { 'iPhone' }
|
332
|
+
let(:orientation) { :portrait }
|
333
|
+
let(:driver) {
|
334
|
+
Webdriver::UserAgent.driver(
|
335
|
+
viewport_width: "#{width}",
|
336
|
+
viewport_height: height,
|
337
|
+
agent: device_key
|
338
|
+
)
|
339
|
+
}
|
98
340
|
|
99
|
-
|
341
|
+
it_behaves_like "browser driver"
|
342
|
+
it "uses user-provided dimensions" do
|
343
|
+
expect(driver.execute_script(width_script)).to eq(width)
|
344
|
+
expect(driver.execute_script(height_script)).to eq(height - FIREFOXBROWSER_UICHROME_HEIGHT)
|
345
|
+
end
|
346
|
+
end
|
347
|
+
|
348
|
+
context "user-provided nonsense viewport size for firefox" do
|
349
|
+
let(:browser) { :firefox }
|
350
|
+
let(:device_key) { :iphone8 }
|
351
|
+
let(:device) { devices[device_key] }
|
352
|
+
let(:width) { "xyz" }
|
353
|
+
let(:agent_match) { 'iPhone' }
|
354
|
+
let(:orientation) { :portrait }
|
355
|
+
let(:driver) {
|
356
|
+
Webdriver::UserAgent.driver(
|
357
|
+
viewport_width: "#{width}",
|
358
|
+
agent: device_key
|
359
|
+
)
|
360
|
+
}
|
361
|
+
|
362
|
+
it_behaves_like "browser driver"
|
363
|
+
it_behaves_like "firefox size"
|
364
|
+
end
|
365
|
+
|
366
|
+
context "portrait firefox iphone" do
|
367
|
+
let(:browser) { :firefox }
|
368
|
+
let(:device_key) { :iphone }
|
369
|
+
let(:device) { devices[device_key] }
|
370
|
+
let(:width) { "xyz" }
|
371
|
+
let(:agent_match) { 'iPhone' }
|
372
|
+
let(:orientation) { :portrait }
|
373
|
+
let(:driver) {
|
374
|
+
Webdriver::UserAgent.driver(
|
375
|
+
agent: device_key,
|
376
|
+
browser: browser,
|
377
|
+
orientation: orientation
|
378
|
+
)
|
379
|
+
}
|
380
|
+
|
381
|
+
it "can create a browser using the driver" do
|
382
|
+
browser = Watir::Browser.new(driver)
|
383
|
+
|
384
|
+
expect(browser).to be_a(Watir::Browser)
|
385
|
+
expect(browser.url).to be_a(String)
|
386
|
+
end
|
387
|
+
end
|
388
|
+
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
|
-
gem.authors = ["Alister Scott", "Jeff Morgan"]
|
5
|
-
gem.email = ["alister.scott@gmail.com", "jeff.morgan@leandog.com"]
|
4
|
+
gem.authors = ["Alister Scott", "Jeff Morgan", "Sandeep Singh", "Sam Nissen"]
|
5
|
+
gem.email = ["alister.scott@gmail.com", "jeff.morgan@leandog.com", "sandeepnagra@gmail.com", "scnissen@gmail.com"]
|
6
6
|
gem.description = %q{A helper gem to emulate populate device user agents and resolutions when using webdriver}
|
7
7
|
gem.summary = %q{A helper gem to emulate populate device user agents and resolutions when using webdriver}
|
8
8
|
gem.homepage = "https://github.com/alisterscott/webdriver-user-agent"
|
@@ -12,11 +12,16 @@ Gem::Specification.new do |gem|
|
|
12
12
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
13
13
|
gem.name = "webdriver-user-agent"
|
14
14
|
gem.require_paths = ["lib"]
|
15
|
-
gem.version = "7.
|
16
|
-
gem.
|
15
|
+
gem.version = "7.8"
|
16
|
+
gem.requirements << 'chromedriver, v2.20'
|
17
|
+
# chromedriver v2.19 causes
|
18
|
+
# Selenium::WebDriver::Error::NoSuchDriverError: no such session errors
|
19
|
+
gem.add_dependency 'selenium-webdriver', '>= 3.4.0'
|
20
|
+
gem.add_dependency 'os'
|
17
21
|
gem.add_dependency 'facets'
|
18
22
|
gem.add_dependency 'json'
|
23
|
+
gem.add_dependency 'psych'
|
19
24
|
gem.add_development_dependency 'rspec'
|
20
|
-
gem.add_development_dependency 'watir
|
21
|
-
|
25
|
+
gem.add_development_dependency 'watir'
|
26
|
+
gem.add_development_dependency 'webdrivers'
|
22
27
|
end
|
metadata
CHANGED
@@ -1,95 +1,128 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webdriver-user-agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '7.
|
5
|
-
prerelease:
|
4
|
+
version: '7.8'
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Alister Scott
|
9
8
|
- Jeff Morgan
|
9
|
+
- Sandeep Singh
|
10
|
+
- Sam Nissen
|
10
11
|
autorequire:
|
11
12
|
bindir: bin
|
12
13
|
cert_chain: []
|
13
|
-
date:
|
14
|
+
date: 2020-07-10 00:00:00.000000000 Z
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
16
17
|
name: selenium-webdriver
|
17
18
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
19
|
requirements:
|
20
|
-
- -
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 3.4.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.4.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: os
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - ">="
|
21
35
|
- !ruby/object:Gem::Version
|
22
36
|
version: '0'
|
23
37
|
type: :runtime
|
24
38
|
prerelease: false
|
25
39
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
40
|
requirements:
|
28
|
-
- -
|
41
|
+
- - ">="
|
29
42
|
- !ruby/object:Gem::Version
|
30
43
|
version: '0'
|
31
44
|
- !ruby/object:Gem::Dependency
|
32
45
|
name: facets
|
33
46
|
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
47
|
requirements:
|
36
|
-
- -
|
48
|
+
- - ">="
|
37
49
|
- !ruby/object:Gem::Version
|
38
50
|
version: '0'
|
39
51
|
type: :runtime
|
40
52
|
prerelease: false
|
41
53
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
54
|
requirements:
|
44
|
-
- -
|
55
|
+
- - ">="
|
45
56
|
- !ruby/object:Gem::Version
|
46
57
|
version: '0'
|
47
58
|
- !ruby/object:Gem::Dependency
|
48
59
|
name: json
|
49
60
|
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
61
|
requirements:
|
52
|
-
- -
|
62
|
+
- - ">="
|
53
63
|
- !ruby/object:Gem::Version
|
54
64
|
version: '0'
|
55
65
|
type: :runtime
|
56
66
|
prerelease: false
|
57
67
|
version_requirements: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
68
|
requirements:
|
60
|
-
- -
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
- !ruby/object:Gem::Dependency
|
73
|
+
name: psych
|
74
|
+
requirement: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
type: :runtime
|
80
|
+
prerelease: false
|
81
|
+
version_requirements: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
61
84
|
- !ruby/object:Gem::Version
|
62
85
|
version: '0'
|
63
86
|
- !ruby/object:Gem::Dependency
|
64
87
|
name: rspec
|
65
88
|
requirement: !ruby/object:Gem::Requirement
|
66
|
-
none: false
|
67
89
|
requirements:
|
68
|
-
- -
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
type: :development
|
94
|
+
prerelease: false
|
95
|
+
version_requirements: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
- !ruby/object:Gem::Dependency
|
101
|
+
name: watir
|
102
|
+
requirement: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
69
105
|
- !ruby/object:Gem::Version
|
70
106
|
version: '0'
|
71
107
|
type: :development
|
72
108
|
prerelease: false
|
73
109
|
version_requirements: !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
75
110
|
requirements:
|
76
|
-
- -
|
111
|
+
- - ">="
|
77
112
|
- !ruby/object:Gem::Version
|
78
113
|
version: '0'
|
79
114
|
- !ruby/object:Gem::Dependency
|
80
|
-
name:
|
115
|
+
name: webdrivers
|
81
116
|
requirement: !ruby/object:Gem::Requirement
|
82
|
-
none: false
|
83
117
|
requirements:
|
84
|
-
- -
|
118
|
+
- - ">="
|
85
119
|
- !ruby/object:Gem::Version
|
86
120
|
version: '0'
|
87
121
|
type: :development
|
88
122
|
prerelease: false
|
89
123
|
version_requirements: !ruby/object:Gem::Requirement
|
90
|
-
none: false
|
91
124
|
requirements:
|
92
|
-
- -
|
125
|
+
- - ">="
|
93
126
|
- !ruby/object:Gem::Version
|
94
127
|
version: '0'
|
95
128
|
description: A helper gem to emulate populate device user agents and resolutions when
|
@@ -97,14 +130,16 @@ description: A helper gem to emulate populate device user agents and resolutions
|
|
97
130
|
email:
|
98
131
|
- alister.scott@gmail.com
|
99
132
|
- jeff.morgan@leandog.com
|
133
|
+
- sandeepnagra@gmail.com
|
134
|
+
- scnissen@gmail.com
|
100
135
|
executables: []
|
101
136
|
extensions: []
|
102
137
|
extra_rdoc_files: []
|
103
138
|
files:
|
104
|
-
- .gitignore
|
105
|
-
- .rspec
|
106
|
-
- .ruby-gemset
|
107
|
-
- .ruby-version
|
139
|
+
- ".gitignore"
|
140
|
+
- ".rspec"
|
141
|
+
- ".ruby-gemset"
|
142
|
+
- ".ruby-version"
|
108
143
|
- ChangeLog
|
109
144
|
- Gemfile
|
110
145
|
- HISTORY.md
|
@@ -122,27 +157,26 @@ files:
|
|
122
157
|
- webdriver-user-agent.gemspec
|
123
158
|
homepage: https://github.com/alisterscott/webdriver-user-agent
|
124
159
|
licenses: []
|
160
|
+
metadata: {}
|
125
161
|
post_install_message:
|
126
162
|
rdoc_options: []
|
127
163
|
require_paths:
|
128
164
|
- lib
|
129
165
|
required_ruby_version: !ruby/object:Gem::Requirement
|
130
|
-
none: false
|
131
166
|
requirements:
|
132
|
-
- -
|
167
|
+
- - ">="
|
133
168
|
- !ruby/object:Gem::Version
|
134
169
|
version: '0'
|
135
170
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
|
-
none: false
|
137
171
|
requirements:
|
138
|
-
- -
|
172
|
+
- - ">="
|
139
173
|
- !ruby/object:Gem::Version
|
140
174
|
version: '0'
|
141
|
-
requirements:
|
142
|
-
|
143
|
-
rubygems_version: 1.
|
175
|
+
requirements:
|
176
|
+
- chromedriver, v2.20
|
177
|
+
rubygems_version: 3.1.2
|
144
178
|
signing_key:
|
145
|
-
specification_version:
|
179
|
+
specification_version: 4
|
146
180
|
summary: A helper gem to emulate populate device user agents and resolutions when
|
147
181
|
using webdriver
|
148
182
|
test_files:
|