Closed ondrejmirtes closed 6 years ago
Hi @ondrejmirtes,
as far as i know, there are two way to change user agent:
pass the --user-agent
flag to chromeFlags options when creating chromy instance.
use custom device. (sorry currently it's undocumented.)
Chromy.addCustomDevice({
name: 'iPhone6'
width: 750,
height: 1334,
deviceScaleFactor: 2.0,
pageScaleFactor: 1.0,
mobile: true,
userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1',
})
const chromy = new Chromy()
chromy.emulate('iPhone6')
.goto(url)
.end()
Thank you! π
@ondrejmirtes sorry, I had forgot another way.
const chromy = new Chromy()
chromy.userAgent('Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1')
.goto(url)
.end()
Is there a way to simulate a different user agent string with Chromy? My usecase is that I want the application to recognize when Chromy is doing the request so that it can react to that, via a user agent string.