@@ -138,10 +138,6 @@ def close_connection
138
138
#
139
139
# Overrides device screen dimensions and emulates viewport according to parameters.
140
140
#
141
- # Note that passing mobile: true will cause set_viewport to ignore the passed
142
- # height and width values, and instead use 390 x 844, which is the viewport size
143
- # of an iPhone 14.
144
- #
145
141
# Read more [here](https://chromedevtools.github.io/devtools-protocol/tot/Emulation/#method-setDeviceMetricsOverride).
146
142
#
147
143
# @param [Integer] width width value in pixels. 0 disables the override
@@ -159,37 +155,24 @@ def set_viewport(width:, height:, scale_factor: 0, mobile: false)
159
155
enabled : true ,
160
156
maxTouchPoints : 1
161
157
)
162
-
163
- command (
164
- "Emulation.setDeviceMetricsOverride" ,
165
- deviceScaleFactor : 3.0 ,
166
- height : 844 ,
167
- mobile : true ,
168
- slowmoable : true ,
169
- width : 390
170
- )
171
158
else
172
159
command (
173
160
"Emulation.setTouchEmulationEnabled" ,
174
161
enabled : false
175
162
)
176
-
177
- command (
178
- "Emulation.setDeviceMetricsOverride" ,
179
- deviceScaleFactor : scale_factor ,
180
- height : height ,
181
- mobile : false ,
182
- slowmoable : true ,
183
- width : width
184
- )
185
163
end
164
+
165
+ command (
166
+ "Emulation.setDeviceMetricsOverride" ,
167
+ deviceScaleFactor : 3.0 ,
168
+ height : height ,
169
+ mobile : true ,
170
+ slowmoable : true ,
171
+ width : width
172
+ )
186
173
end
187
174
188
175
def resize ( width : nil , height : nil , fullscreen : false , mobile : false )
189
- if mobile && ( height != 0 || width != 0 )
190
- raise "specifying `mobile: true` causes automatic resizing to mobile dimensions"
191
- end
192
-
193
176
if fullscreen
194
177
width , height = document_size
195
178
self . window_bounds = { window_state : "fullscreen" }
0 commit comments