| 1 |
// Package main ... |
| 2 |
package main |
| 3 |
|
| 4 |
import ( |
| 5 |
"github.com/go-rod/rod" |
| 6 |
"github.com/go-rod/rod/lib/devices" |
| 7 |
) |
| 8 |
|
| 9 |
func main() { |
| 10 |
page := rod.New().MustConnect().MustPage() |
| 11 |
|
| 12 |
// emulate iPhone 7 landscape |
| 13 |
err := page.Emulate(devices.IPhone6or7or8.Landscape()) |
| 14 |
if err != nil { |
| 15 |
panic(err) |
| 16 |
} |
| 17 |
|
| 18 |
page.MustNavigate("https://www.whatsmyua.info/") |
| 19 |
page.MustScreenshot("screenshot1.png") |
| 20 |
|
| 21 |
// reset |
| 22 |
page.MustEmulate(devices.Clear) |
| 23 |
|
| 24 |
page.MustSetViewport(1920, 2000, 1, false) |
| 25 |
page.MustNavigate("https://www.whatsmyua.info/?a") |
| 26 |
page.MustScreenshot("screenshot2.png") |
| 27 |
} |