sitespeed.io icon indicating copy to clipboard operation
sitespeed.io copied to clipboard

--mobile doesn't set correct userAgent

Open Arhane opened this issue 6 years ago • 2 comments

First of all, thanks a lot for your great work!

I have found a bug where --mobile doesn't set correct userAgent.

I run docker-version sitespeed 13.3.0

I run this script

module.exports = async function(context, commands) {
    await commands.navigate('https://www.ozon.ru/');

    console.log(await commands.js.run('return window.navigator.userAgent'));
    console.log(await commands.js.run('return window.innerWidth'))
    console.log(await commands.js.run('return window.innerHeight'))
};

with this command docker run --rm -v "$(pwd)":/sitespeed.io sitespeedio/sitespeed.io:13.3.0 nodes/node4/configs/scripts/pdpToPdp.js -n 1 --spa --multi --mobile

And I get this user agent Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36. And it doesn't match the real user agent from iphone. User agent from iphone should look like this 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

Arhane avatar Jun 17 '20 12:06 Arhane

Hi @Arhane thanks for creating the issue. Yes you are right. I did a quick check (using https://httpbin.org/user-agent) and it looks like when you set the mobile emulation in Chrome, the user agent isn't automatically changed. Let me fix that for the next release.

soulgalore avatar Jun 18 '20 20:06 soulgalore

This has been fix. Try out latest release.

soulgalore avatar Jul 19 '20 19:07 soulgalore