@@ -138,10 +138,6 @@ def close_connection
138138 #
139139 # Overrides device screen dimensions and emulates viewport according to parameters.
140140 #
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- #
145141 # Read more [here](https://chromedevtools.github.io/devtools-protocol/tot/Emulation/#method-setDeviceMetricsOverride).
146142 #
147143 # @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)
159155 enabled : true ,
160156 maxTouchPoints : 1
161157 )
162-
163- command (
164- "Emulation.setDeviceMetricsOverride" ,
165- deviceScaleFactor : 3.0 ,
166- height : 844 ,
167- mobile : true ,
168- slowmoable : true ,
169- width : 390
170- )
171158 else
172159 command (
173160 "Emulation.setTouchEmulationEnabled" ,
174161 enabled : false
175162 )
176-
177- command (
178- "Emulation.setDeviceMetricsOverride" ,
179- deviceScaleFactor : scale_factor ,
180- height : height ,
181- mobile : false ,
182- slowmoable : true ,
183- width : width
184- )
185163 end
164+
165+ command (
166+ "Emulation.setDeviceMetricsOverride" ,
167+ deviceScaleFactor : scale_factor ,
168+ height : height ,
169+ mobile : true ,
170+ slowmoable : true ,
171+ width : width
172+ )
186173 end
187174
188175 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-
193176 if fullscreen
194177 width , height = document_size
195178 self . window_bounds = { window_state : "fullscreen" }
0 commit comments