How to use the devices function from puppeteer

Find comprehensive JavaScript puppeteer.devices code examples handpicked from public code repositorys.

147
148
149
150
151
152
153
154
155
if (request.options && request.options.userAgent) {
    await page.setUserAgent(request.options.userAgent);
}

if (request.options && request.options.device) {
    const devices = puppet.devices;
    const device = devices[request.options.device];
    await page.emulate(device);
}
fork icon0
star icon0
watch icon1

+ 15 other calls in file

127
128
129
130
131
132
133
134
135
if (request.options && request.options.userAgent) {
    await page.setUserAgent(request.options.userAgent);
}

if (request.options && request.options.device) {
    const devices = puppeteer.devices;
    const device = devices[request.options.device];
    await page.emulate(device);
}
fork icon0
star icon0
watch icon0