Skip to content

Commit dce6099

Browse files
committed
Update README
Add details of resize and mobile behavior to the README. Note that the behaviour on height or width of 0 was pre-existing; I just documented it and added a spec.
1 parent cc7610d commit dce6099

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ Ferrum::Browser.new(options)
195195
* `:proxy` (Hash) - Specify proxy settings, [read more](https://github.com/rubycdp/ferrum#proxy)
196196
* `:save_path` (String) - Path to save attachments with [Content-Disposition](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition) header.
197197
* `:env` (Hash) - Environment variables you'd like to pass through to the process
198-
198+
* `:mobile` (Boolean) - Specify whether to enable mobile emulation and touch UI.
199199

200200
## Navigation
201201

@@ -1089,6 +1089,13 @@ Overrides device screen dimensions and emulates viewport.
10891089
* :scale_factor `Float`, device scale factor. `0` by default
10901090
* :mobile `Boolean`, whether to emulate mobile device. `false` by default
10911091

1092+
Values of `0` for either `:width` or `:height` will be ignored; i.e., no viewport resize will take place.
1093+
1094+
If `:mobile` is `true`:
1095+
1096+
1. `:height` and `:width` will be ignored, and instead the viewport size of an iPhone 14 will be used (390 x 844).
1097+
2. Touch emulation will be enabled, with a maximum of 1 touch point.
1098+
10921099
```ruby
10931100
page.set_viewport(width: 1000, height: 600, scale_factor: 3)
10941101
```

0 commit comments

Comments
 (0)