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

Make it possible to set browsertime.chrome.mobileEmulation.* options

Open eserte opened this issue 7 years ago • 9 comments

Currently it's not possible to overwrite the hardcoded deviceName='iPhone 6' (reason is that in analyzeUrl() in plugins/browsertime/analyzer.js chromeIphoneEmulationOptions containing the defaults comes after btOptions.chrome).

Additionally, it's also not possible to unset the default deviceName, and use other possibly conflicting mobileEmulation options like userAgent (if deviceName and userAgent are both set, then the error 'deviceName' must be used alone appears).

If this was possible, then the current limitation of setting --mobile overriding --browsertime.userAgent could be workarounded.

eserte avatar Sep 13 '18 08:09 eserte

Hi @eserte thanks for reporting! Any change you can do a PR? I was planning on pushing a new release of sitespeed.io tomorrow (with updated browsers) and we can probably just fix this first then.

Best Peter

soulgalore avatar Sep 13 '18 08:09 soulgalore

@eserte I've pushed a fix so we at least can change device name.

Workaround for the other is at the moment to not set --mobile, instead use viewport and user agent.

Best Peter

soulgalore avatar Sep 13 '18 11:09 soulgalore

@eserte if you try latest 7.4.0 then at least you should be able to choose name.

soulgalore avatar Sep 14 '18 06:09 soulgalore

Workaround for the other is at the moment to not set --mobile, instead use viewport and user agent.

If I do so, then the sitespeed result pages show the "... runs with desktop profile ..." text instead of "mobile profile" --- which is at least confusing. It's also not clear if --mobile enables some other mobile emulation features in the browser.

eserte avatar Sep 14 '18 07:09 eserte

Yeah I see your point. I think the only way to get it right at the moment is to use Firefox.

soulgalore avatar Sep 14 '18 17:09 soulgalore

Hello @soulgalore, good morning!

We are experiencing the above issue for our current project: we want to use Chrome emulated devices, but we also want to specify a UserAgent, in order to add a string given to us by our security team.

Having taken a look at the commit made in by @eserte to a private fork, referencing this issue - it appears that this change would allow us to optionally specify the User Agent.

If I am understanding this correctly, would you accept this as a PR?

barryperez avatar Dec 28 '21 09:12 barryperez

Hi @barryperez in https://github.com/sitespeedio/browsertime/pull/1688 I'm adding so you can append what you want to the user agent, let me do a follow up in browsertime and also fix so that if you set the --userAgent its automatically set for mobile emulation, then I can fix it in sitespeed.io. Hope to fix it the coming weekend.

soulgalore avatar Dec 30 '21 07:12 soulgalore

I released 21.3.0 earlier today that fixes so that --userAgent also will be used for emulated devices.

soulgalore avatar Jan 01 '22 22:01 soulgalore

Tested successfully - thank you very much for fixing this @soulgalore!

barryperez avatar Jan 05 '22 14:01 barryperez