[Question] How to connect Lighthouse CLI to Android's app webview
See original GitHub issueI know how to connect to Google Chrome on Android (by forwarding tcp:9222 localabstract:chrome_devtools_remote
), but I can’t find how to run a lighthouse test for a debuggable webview in an app. Webview is visible in chrome://inspect
and I can run an audit from there but I need to pass custom config to the LS test.
Passing a config file through desktop Chrome would be also good enough for my use case but automating it with CLI would be even better.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top Results From Across the Web
[Q] Can Lighthouse be used with Android WebView-based ...
I have an app (browser) based on Android WebView and i'd like to audit it with Lighthouse. I'm able to connect to Chrome...
Read more >WebView - The correct way to use credentials - Stack Overflow
I am looking for a way to autofill the password. How can I solve it? My application's code is like this: package com.example.tehem.webviewapp;...
Read more >Lighthouse: Optimize website speed - Chrome Developers
Press Command+Option+J (Mac) Control+Shift+J (Windows, Linux, ChromeOS). Chrome DevTools opens up alongside the demo. DevTools and the demo.
Read more >Using Google Lighthouse to audit your web application
We will look at how you can use Google Lighthouse to effectively assess the performance of your web application and deliver a superior...
Read more >WEBVIEW no longer work or suported. Need REST code.
I need REST code to replace the below WEBVIEW code to execute my web site. using Android.App; using Android.OS; using Android.Support.V7.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The DevTools integration is built specifically to keep the existing page intact. It does not use the same target creation path that the node/CLI uses.
Not without a lot of work 😃 You could use a custom-devtools-frontend and modify the config used by Lighthouse, but it’d probably be easier to just redeploy the page in a way that’s accessible from proper Android Chrome 😅
DevTools reimplements its own custom connection class that does not create new targets like the node/CLI path does.
This is the bit of code used by node/CLI that creates a new target to evaluate when lighthouse connects to Chrome.
https://github.com/GoogleChrome/lighthouse/blob/800ffd6da37e1be6712b04906d9abc701ff49fb6/lighthouse-core/gather/connections/cri.js#L36-L53
You would need to implement your own connection that skips this step in node.
As seen above, it’s not the communication method that’s the problem, it’s the fact that new targets are created.