devices

原文:https://pkg.go.dev/github.com/go-rod/rod/lib/devices

收录该文档时间:2024-11-20T18:02:07+08:00

Version: v0.116.2

Overview

Package devices …

常量

This section is empty.

变量

View Source

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
var (

	// IPhone4 device.
	IPhone4 = Device{
		Title:          "iPhone 4",
		Capabilities:   []string{"touch", "mobile"},
		UserAgent:      "Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D257 Safari/9537.53",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 2,
			Horizontal: ScreenSize{
				Width:  480,
				Height: 320,
			},
			Vertical: ScreenSize{
				Width:  320,
				Height: 480,
			},
		},
	}

	// IPhone5orSE device.
	IPhone5orSE = Device{
		Title:          "iPhone 5/SE",
		Capabilities:   []string{"touch", "mobile"},
		UserAgent:      "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 2,
			Horizontal: ScreenSize{
				Width:  568,
				Height: 320,
			},
			Vertical: ScreenSize{
				Width:  320,
				Height: 568,
			},
		},
	}

	// IPhone6or7or8 device.
	IPhone6or7or8 = Device{
		Title:          "iPhone 6/7/8",
		Capabilities:   []string{"touch", "mobile"},
		UserAgent:      "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 2,
			Horizontal: ScreenSize{
				Width:  667,
				Height: 375,
			},
			Vertical: ScreenSize{
				Width:  375,
				Height: 667,
			},
		},
	}

	// IPhone6or7or8Plus device.
	IPhone6or7or8Plus = Device{
		Title:          "iPhone 6/7/8 Plus",
		Capabilities:   []string{"touch", "mobile"},
		UserAgent:      "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 3,
			Horizontal: ScreenSize{
				Width:  736,
				Height: 414,
			},
			Vertical: ScreenSize{
				Width:  414,
				Height: 736,
			},
		},
	}

	// IPhoneX device.
	IPhoneX = Device{
		Title:          "iPhone X",
		Capabilities:   []string{"touch", "mobile"},
		UserAgent:      "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 3,
			Horizontal: ScreenSize{
				Width:  812,
				Height: 375,
			},
			Vertical: ScreenSize{
				Width:  375,
				Height: 812,
			},
		},
	}

	// BlackBerryZ30 device.
	BlackBerryZ30 = Device{
		Title:          "BlackBerry Z30",
		Capabilities:   []string{"touch", "mobile"},
		UserAgent:      "Mozilla/5.0 (BB10; Touch) AppleWebKit/537.10+ (KHTML, like Gecko) Version/10.0.9.2372 Mobile Safari/537.10+",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 2,
			Horizontal: ScreenSize{
				Width:  640,
				Height: 360,
			},
			Vertical: ScreenSize{
				Width:  360,
				Height: 640,
			},
		},
	}

	// Nexus4 device.
	Nexus4 = Device{
		Title:          "Nexus 4",
		Capabilities:   []string{"touch", "mobile"},
		UserAgent:      "Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Mobile Safari/537.36",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 2,
			Horizontal: ScreenSize{
				Width:  640,
				Height: 384,
			},
			Vertical: ScreenSize{
				Width:  384,
				Height: 640,
			},
		},
	}

	// Nexus5 device.
	Nexus5 = Device{
		Title:          "Nexus 5",
		Capabilities:   []string{"touch", "mobile"},
		UserAgent:      "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Mobile Safari/537.36",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 3,
			Horizontal: ScreenSize{
				Width:  640,
				Height: 360,
			},
			Vertical: ScreenSize{
				Width:  360,
				Height: 640,
			},
		},
	}

	// Nexus5X device.
	Nexus5X = Device{
		Title:          "Nexus 5X",
		Capabilities:   []string{"touch", "mobile"},
		UserAgent:      "Mozilla/5.0 (Linux; Android 8.0.0; Nexus 5X Build/OPR4.170623.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Mobile Safari/537.36",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 2,
			Horizontal: ScreenSize{
				Width:  732,
				Height: 412,
			},
			Vertical: ScreenSize{
				Width:  412,
				Height: 732,
			},
		},
	}

	// Nexus6 device.
	Nexus6 = Device{
		Title:          "Nexus 6",
		Capabilities:   []string{"touch", "mobile"},
		UserAgent:      "Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F26U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Mobile Safari/537.36",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 3,
			Horizontal: ScreenSize{
				Width:  732,
				Height: 412,
			},
			Vertical: ScreenSize{
				Width:  412,
				Height: 732,
			},
		},
	}

	// Nexus6P device.
	Nexus6P = Device{
		Title:          "Nexus 6P",
		Capabilities:   []string{"touch", "mobile"},
		UserAgent:      "Mozilla/5.0 (Linux; Android 8.0.0; Nexus 6P Build/OPP3.170518.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Mobile Safari/537.36",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 3,
			Horizontal: ScreenSize{
				Width:  732,
				Height: 412,
			},
			Vertical: ScreenSize{
				Width:  412,
				Height: 732,
			},
		},
	}

	// Pixel2 device.
	Pixel2 = Device{
		Title:          "Pixel 2",
		Capabilities:   []string{"touch", "mobile"},
		UserAgent:      "Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Mobile Safari/537.36",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 2,
			Horizontal: ScreenSize{
				Width:  731,
				Height: 411,
			},
			Vertical: ScreenSize{
				Width:  411,
				Height: 731,
			},
		},
	}

	// Pixel2XL device.
	Pixel2XL = Device{
		Title:          "Pixel 2 XL",
		Capabilities:   []string{"touch", "mobile"},
		UserAgent:      "Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Mobile Safari/537.36",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 3,
			Horizontal: ScreenSize{
				Width:  823,
				Height: 411,
			},
			Vertical: ScreenSize{
				Width:  411,
				Height: 823,
			},
		},
	}

	// LGOptimusL70 device.
	LGOptimusL70 = Device{
		Title:          "LG Optimus L70",
		Capabilities:   []string{"touch", "mobile"},
		UserAgent:      "Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LGMS323 Build/KOT49I.MS32310c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/114.0.0.0 Mobile Safari/537.36",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 1,
			Horizontal: ScreenSize{
				Width:  640,
				Height: 384,
			},
			Vertical: ScreenSize{
				Width:  384,
				Height: 640,
			},
		},
	}

	// NokiaN9 device.
	NokiaN9 = Device{
		Title:          "Nokia N9",
		Capabilities:   []string{"touch", "mobile"},
		UserAgent:      "Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 1,
			Horizontal: ScreenSize{
				Width:  854,
				Height: 480,
			},
			Vertical: ScreenSize{
				Width:  480,
				Height: 854,
			},
		},
	}

	// NokiaLumia520 device.
	NokiaLumia520 = Device{
		Title:          "Nokia Lumia 520",
		Capabilities:   []string{"touch", "mobile"},
		UserAgent:      "Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 520)",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 1,
			Horizontal: ScreenSize{
				Width:  533,
				Height: 320,
			},
			Vertical: ScreenSize{
				Width:  320,
				Height: 533,
			},
		},
	}

	// MicrosoftLumia550 device.
	MicrosoftLumia550 = Device{
		Title:          "Microsoft Lumia 550",
		Capabilities:   []string{"touch", "mobile"},
		UserAgent:      "Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 550) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Mobile Safari/537.36 Edge/14.14263",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 2,
			Horizontal: ScreenSize{
				Width:  640,
				Height: 360,
			},
			Vertical: ScreenSize{
				Width:  640,
				Height: 360,
			},
		},
	}

	// MicrosoftLumia950 device.
	MicrosoftLumia950 = Device{
		Title:          "Microsoft Lumia 950",
		Capabilities:   []string{"touch", "mobile"},
		UserAgent:      "Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 950) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Mobile Safari/537.36 Edge/14.14263",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 4,
			Horizontal: ScreenSize{
				Width:  640,
				Height: 360,
			},
			Vertical: ScreenSize{
				Width:  360,
				Height: 640,
			},
		},
	}

	// GalaxySIII device.
	GalaxySIII = Device{
		Title:          "Galaxy S III",
		Capabilities:   []string{"touch", "mobile"},
		UserAgent:      "Mozilla/5.0 (Linux; U; Android 4.0; en-us; GT-I9300 Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 2,
			Horizontal: ScreenSize{
				Width:  640,
				Height: 360,
			},
			Vertical: ScreenSize{
				Width:  360,
				Height: 640,
			},
		},
	}

	// GalaxyS5 device.
	GalaxyS5 = Device{
		Title:          "Galaxy S5",
		Capabilities:   []string{"touch", "mobile"},
		UserAgent:      "Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Mobile Safari/537.36",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 3,
			Horizontal: ScreenSize{
				Width:  640,
				Height: 360,
			},
			Vertical: ScreenSize{
				Width:  360,
				Height: 640,
			},
		},
	}

	// JioPhone2 device.
	JioPhone2 = Device{
		Title:          "JioPhone 2",
		Capabilities:   []string{"touch", "mobile"},
		UserAgent:      "Mozilla/5.0 (Mobile; LYF/F300B/LYF-F300B-001-01-15-130718-i;Android; rv:48.0) Gecko/48.0 Firefox/48.0 KAIOS/2.5",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 1,
			Horizontal: ScreenSize{
				Width:  320,
				Height: 240,
			},
			Vertical: ScreenSize{
				Width:  240,
				Height: 320,
			},
		},
	}

	// KindleFireHDX device.
	KindleFireHDX = Device{
		Title:          "Kindle Fire HDX",
		Capabilities:   []string{"touch", "mobile"},
		UserAgent:      "Mozilla/5.0 (Linux; U; en-us; KFAPWI Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.13 Safari/535.19 Silk-Accelerated=true",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 2,
			Horizontal: ScreenSize{
				Width:  1280,
				Height: 800,
			},
			Vertical: ScreenSize{
				Width:  800,
				Height: 1280,
			},
		},
	}

	// IPadMini device.
	IPadMini = Device{
		Title:          "iPad Mini",
		Capabilities:   []string{"touch", "mobile"},
		UserAgent:      "Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 2,
			Horizontal: ScreenSize{
				Width:  1024,
				Height: 768,
			},
			Vertical: ScreenSize{
				Width:  768,
				Height: 1024,
			},
		},
	}

	// IPad device.
	IPad = Device{
		Title:          "iPad",
		Capabilities:   []string{"touch", "mobile"},
		UserAgent:      "Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 2,
			Horizontal: ScreenSize{
				Width:  1024,
				Height: 768,
			},
			Vertical: ScreenSize{
				Width:  768,
				Height: 1024,
			},
		},
	}

	// IPadPro device.
	IPadPro = Device{
		Title:          "iPad Pro",
		Capabilities:   []string{"touch", "mobile"},
		UserAgent:      "Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 2,
			Horizontal: ScreenSize{
				Width:  1366,
				Height: 1024,
			},
			Vertical: ScreenSize{
				Width:  1024,
				Height: 1366,
			},
		},
	}

	// BlackberryPlayBook device.
	BlackberryPlayBook = Device{
		Title:          "Blackberry PlayBook",
		Capabilities:   []string{"touch", "mobile"},
		UserAgent:      "Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML like Gecko) Version/7.2.1.0 Safari/536.2+",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 1,
			Horizontal: ScreenSize{
				Width:  1024,
				Height: 600,
			},
			Vertical: ScreenSize{
				Width:  600,
				Height: 1024,
			},
		},
	}

	// Nexus10 device.
	Nexus10 = Device{
		Title:          "Nexus 10",
		Capabilities:   []string{"touch", "mobile"},
		UserAgent:      "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 10 Build/MOB31T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 2,
			Horizontal: ScreenSize{
				Width:  1280,
				Height: 800,
			},
			Vertical: ScreenSize{
				Width:  800,
				Height: 1280,
			},
		},
	}

	// Nexus7 device.
	Nexus7 = Device{
		Title:          "Nexus 7",
		Capabilities:   []string{"touch", "mobile"},
		UserAgent:      "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 7 Build/MOB30X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 2,
			Horizontal: ScreenSize{
				Width:  960,
				Height: 600,
			},
			Vertical: ScreenSize{
				Width:  600,
				Height: 960,
			},
		},
	}

	// GalaxyNote3 device.
	GalaxyNote3 = Device{
		Title:          "Galaxy Note 3",
		Capabilities:   []string{"touch", "mobile"},
		UserAgent:      "Mozilla/5.0 (Linux; U; Android 4.3; en-us; SM-N900T Build/JSS15J) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 3,
			Horizontal: ScreenSize{
				Width:  640,
				Height: 360,
			},
			Vertical: ScreenSize{
				Width:  360,
				Height: 640,
			},
		},
	}

	// GalaxyNoteII device.
	GalaxyNoteII = Device{
		Title:          "Galaxy Note II",
		Capabilities:   []string{"touch", "mobile"},
		UserAgent:      "Mozilla/5.0 (Linux; U; Android 4.1; en-us; GT-N7100 Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 2,
			Horizontal: ScreenSize{
				Width:  640,
				Height: 360,
			},
			Vertical: ScreenSize{
				Width:  360,
				Height: 640,
			},
		},
	}

	// LaptopWithTouch device.
	LaptopWithTouch = Device{
		Title:          "Laptop with touch",
		Capabilities:   []string{"touch"},
		UserAgent:      "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 1,
			Horizontal: ScreenSize{
				Width:  1280,
				Height: 950,
			},
			Vertical: ScreenSize{
				Width:  950,
				Height: 1280,
			},
		},
	}

	// LaptopWithHiDPIScreen device.
	LaptopWithHiDPIScreen = Device{
		Title:          "Laptop with HiDPI screen",
		Capabilities:   []string{},
		UserAgent:      "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 2,
			Horizontal: ScreenSize{
				Width:  1440,
				Height: 900,
			},
			Vertical: ScreenSize{
				Width:  900,
				Height: 1440,
			},
		},
	}

	// LaptopWithMDPIScreen device.
	LaptopWithMDPIScreen = Device{
		Title:          "Laptop with MDPI screen",
		Capabilities:   []string{},
		UserAgent:      "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 1,
			Horizontal: ScreenSize{
				Width:  1280,
				Height: 800,
			},
			Vertical: ScreenSize{
				Width:  800,
				Height: 1280,
			},
		},
	}

	// MotoG4 device.
	MotoG4 = Device{
		Title:          "Moto G4",
		Capabilities:   []string{"touch", "mobile"},
		UserAgent:      "Mozilla/5.0 (Linux; Android 6.0.1; Moto G (4)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Mobile Safari/537.36",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 3,
			Horizontal: ScreenSize{
				Width:  640,
				Height: 360,
			},
			Vertical: ScreenSize{
				Width:  360,
				Height: 640,
			},
		},
	}

	// SurfaceDuo device.
	SurfaceDuo = Device{
		Title:          "Surface Duo",
		Capabilities:   []string{"touch", "mobile"},
		UserAgent:      "Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Mobile Safari/537.36",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 2,
			Horizontal: ScreenSize{
				Width:  720,
				Height: 540,
			},
			Vertical: ScreenSize{
				Width:  540,
				Height: 720,
			},
		},
	}

	// GalaxyFold device.
	GalaxyFold = Device{
		Title:          "Galaxy Fold",
		Capabilities:   []string{"touch", "mobile"},
		UserAgent:      "Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Mobile Safari/537.36",
		AcceptLanguage: "en",
		Screen: Screen{
			DevicePixelRatio: 3,
			Horizontal: ScreenSize{
				Width:  653,
				Height: 280,
			},
			Vertical: ScreenSize{
				Width:  280,
				Height: 653,
			},
		},
	}
)

View Source

1
var Clear = Device{/* contains filtered or unexported fields */}

Clear is used to clear overrides.

函数

This section is empty.

类型

type Device <- 0.62.0

1
2
3
4
5
6
7
8
type Device struct {
	Capabilities   []string
	UserAgent      string
	AcceptLanguage string
	Screen         Screen
	Title          string
	// contains filtered or unexported fields
}

Device represents a emulated device.

​ Device 表示一个模拟设备。

(Device) IsClear <- 0.84.0

1
func (device Device) IsClear() bool

IsClear type.

​ IsClear 类型。

(Device) Landscape <- 0.112.1

1
func (device Device) Landscape() Device

Landscape clones the device and set it to landscape mode.

​ Landscape 克隆设备并设置为横屏模式。

(Device) MetricsEmulation <- 0.84.0

1
func (device Device) MetricsEmulation() *proto.EmulationSetDeviceMetricsOverride

MetricsEmulation config.

​ MetricsEmulation 配置。

(Device) TouchEmulation <- 0.84.0

1
func (device Device) TouchEmulation() *proto.EmulationSetTouchEmulationEnabled

TouchEmulation config.

​ TouchEmulation 配置。

(Device) UserAgentEmulation <- 0.84.0

1
func (device Device) UserAgentEmulation() *proto.NetworkSetUserAgentOverride

UserAgentEmulation config.

​ UserAgentEmulation 配置。

type Screen <- 0.84.0

1
2
3
4
5
type Screen struct {
	DevicePixelRatio float64
	Horizontal       ScreenSize
	Vertical         ScreenSize
}

Screen represents the screen of a device.

​ Screen 表示设备的屏幕。

type ScreenSize <- 0.84.0

1
2
3
4
type ScreenSize struct {
	Width  int
	Height int
}

ScreenSize represents the size of the screen.

​ ScreenSize 表示屏幕的尺寸。

最后修改 November 21, 2024: 更新 (98fed08)