-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mobile mode is not working even after giving mobile configuration from lighthouse #16126
Comments
The code you provided is not complete and does not compile. Please provide real code. What is the error you see? also, if you are upgrading from v9 then review the breaking changes https://github.com/GoogleChrome/lighthouse/releases/tag/v10.0.0 |
@connorjclark Thank you for quick reply. Below is my code which takes some arguments at runtime and generates the report. import fs from "fs"; const cmdArgs = process?.argv; let categories = getCmdLineArgs(cmdArgs, categoryIndex, "category"); console.log("categories : " + categories); // desktop config to generate report // mobile config to generate report if ( function checkValidityOfCmdLineArgs( if (categories == "") { if (outputType == "") { if (!isMobile && !isDesktop) { if (fileNameInitials == "") { function getCmdLineArgs(cmdArgs, index, type) { async function connectToBrowser(portNo) { return browser; async function getActivePageFromBrowser(browser) { // getting active tab status const currentPage = await pages.filter( return currentPage; async function generateDesktopSnapshot(currentPage, desktopConfig) { console.log(screenInfo); currentPage.setViewport({ // created flow object for desktop and mobile const flowDesktop = await new UserFlow(currentPage, desktopConfig); return { async function generateMobileSnapshot(currentPage, mobileConfig) { async function generateLighthouseReport(path, result) { async function initiateProcess() {
} catch (error) { async function scrollToBottom(page) { async function doExit() { Module.exports = { |
I can't process that really. Put it in a gist or repo? Did you consult the breaking change logs I shared? |
@connorjclark I have gone through change logs I don't see any breaking changes I used in my code. I have uploaded code in git, you can clone it from here https://github.com/umeshaccion/sample-lighthouse.git. Once you clone you can do npm install and you can trigger index.js using below commands. Before running index.js you need to open browser and have it's port no. handy so you can pass in arguments while triggering index.js. node /index.js <categories[]> <output type []> ex. |
FAQ
URL
https://www.google.com
What happened?
report_mobile.json
you can see above report where screenshot are not coming in mobile mode even after using mobile config.
What did you expect?
Should emulate like mobile. which used happen in lighthouse version 9.6.8.
What have you tried?
Have tried mobile configuration passing in userflow method
import {
screenEmulationMetrics,
throttling,
userAgents,
} from "lighthouse/core/config/constants.js";
import config from "lighthouse/core/config/desktop-config.js";
const mobileConfig = {
config: {
extends: "lighthouse:default",
settings: {
formFactor: "mobile",
onlyCategories: categories,
throttling: constants.throttling.mobileSlow4G,
screenEmulation: constants.screenEmulationMetrics.mobile,
emulatedUserAgent: constants.userAgents.mobile,
output: outputType,
},
},
};
const flowMobile = await new UserFlow(currentPage, mobileConfig);
How were you running Lighthouse?
node
Lighthouse Version
12.1.0
Chrome Version
126.0.6478.128
Node Version
20.9.0
OS
windows 10
Relevant log output
It should work in mobile mode and emulate like mobile
The text was updated successfully, but these errors were encountered: