-
Notifications
You must be signed in to change notification settings - Fork 139
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
Run a lighthouse test against the current browser session #395
Comments
I don't understand exactly what you are trying to do. You can't re-use a browser session across a WPT test and a Lighthouse test. Lighthouse makes 3-4 passes across a page measuring different things and is expecting to be in full control and starting from a clean slate. If you need to specify additional headers or cookies it needs to be done explicitly. |
I'm trying to access a page behind auth. For WPT, setCookie is enough. But for LH, the page gets redirected to the login page probably due to some JS code.
Is there another "right" way to inject cookies into the browser for LH to work with WPT other than --extra-headers flag? Thanks for your time! |
The easiest way with lighthouse is to set the cookies as explicit HTTP headers (custom headers in the advanced tab "Cookie: xxxxx"). Lighthouse supports the additional headers. |
This doesn't work for me in both WPT and LH. So I was trying to do something like |
Hi @imkalvin , I'm currently just using a local patch for my test agents. if 'cookies' in self.task:
for cookie in self.task['cookies']:
self.devtools.send_command('Network.setCookie', cookie) I also changed this method and removed the running_lighthouse if statement. I have this patch running thousands of tests daily for the last 6 months and I didn't see anything going wrong for me. |
I can see the comment "Run a lighthouse test against the current browser session"
But, after launching the agent with the browser GUI, I can see the browser closes and a new one spawns just for LH. Which loses the cookies/storage/etc. for my tests.
I applied a quick fix (don't know if this is the right approach here) that might help
wptagent.py
L#129
L#191
devtools_browser.py
L#54
Removed the
ret = self.devtools.wait_for_available(self.CONNECT_TIME_LIMIT)
and made it just connect once to the dev tools interface and not wait/reconnect to the devtools
L#267
The text was updated successfully, but these errors were encountered: