-
Notifications
You must be signed in to change notification settings - Fork 5
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
Update benchmark-web-vitals to allow connection to existing browser instance (e.g. on mobile device) #58
Draft
westonruter
wants to merge
4
commits into
main
Choose a base branch
from
add/connect-existing-browser
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Here's the
|
And another:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This introduces a new
--connect
/-c
option which causespuppeteer.connect()
to be used instead ofpuppeteer.launch()
. This is intended to allow benchmark-web-vitals to run on an existing browser instance, such as on a mobile device:npm run research -- benchmark-web-vitals -u http://example.com -n 1 -p --connect 'ws://127.0.0.1:9222/devtools/browser'
Nevertheless, I've not gotten this to work yet. The process hangs at the call to
puppeteer.connect()
and I'm not sure why.Here is how I set up my environment to test. (See also Remote debug Android devices.)
adb
(Android Debug Studio) is installed. (In Linux,sudo apt-get install adb
.)adb forward tcp:9222 localabstract:chrome_devtools_remote
At this point, when you go to
chrome://inspect/#devices
on your computer, you should see the Android phone connected:Note the Remote Target entry seems to be a mirror of the other target (here Pixel 5) which shows up once you do
adb forward
.At this point as well, you should be able to tap on the inspect link for one of the Chrome tabs listed and get the DevTools opened for that tab:
On your computer, you should be able to un
curl http://localhost:9222/json/version
and get something like:Take note of the
webSocketDebuggerUrl
. This is the value that is passed intopuppeteer.connect()
which is the benchmark-web-vitals command exposes in this PR as--connect
/-c
. Nevertheless, upon trying to run this:npm run research -- benchmark-web-vitals -u https://example.com -n 1 -p -c 'ws://127.0.0.1:9222/devtools/browser'
Nothing happens. And it times out. Sometimes I see a new
about:blank
tab opened on my phone or I'll see the tab navigate to the supplied URL, but otherwise nothing happens in the terminal window. I can see that the call topuppeteer.connect()
seems to hang.What I've tried is somewhat similar to what is outlined in Connecting Puppeteer to Existing Chrome Window w/ reCAPTCHA, but it is specifically for Chrome on Windows not Chrome for Android.