Closed ankur22 closed 4 months ago
I think I have a better idea of what is happening.
I'm not 100% sure how to handle the CDP events incoming from different sessions for the same frame, but I think we can check to see if the incoming detach event's sessionId
matches the frame
's sessionId
, and if they don't match we ignore the event.
Playwright does something similar to what i'm proposing, well, they just check to see if the frame exists with a session.
Puppeteer seems to ignore the swap frameDetach events completely, as in they don't seem to remove any frames :shrug:
@ankur22
👍 Makes sense.
Puppeteer seems to ignore the swap frameDetach events completely, as in they don't seem to remove any frames 🤷
Side note: When I look into the Puppeteer's code, they seem to be doing some actions for the frame-swapped events. This and this.
Side note: When I look into the Puppeteer's code, they seem to be doing some actions for the frame-swapped events. This and this.
Thanks for the links. Yeah, i still don't see them removing the frames, so i feel the solution we're going with (at least for now) is a good one. We might have to change it if we find another edge case with iframe, and bring it more in line with either Playwright or Puppeteer.
Yes, our solution is fine. Just wanted to give a heads-up about the future changes.
On Fri, May 24, 2024 at 1:40 PM Ankur @.***> wrote:
Side note: When I look into the Puppeteer's code, they seem to be doing some actions for the frame-swapped events. This https://github.com/puppeteer/puppeteer/blob/d963fcdd80dbcf26fc6e169917ddd18e7a751f4f/packages/puppeteer-core/src/cdp/LifecycleWatcher.ts#L224-L265 and this https://github.com/puppeteer/puppeteer/blob/d963fcdd80dbcf26fc6e169917ddd18e7a751f4f/packages/puppeteer-core/src/cdp/Frame.ts#L73-L77 .
Thanks for the links. Yeah, i still don't see them removing the frames, so i feel the solution we're going with (at least for now) is a good one. We maybe have to change it if we find another edge case with iframe.
— Reply to this email directly, view it on GitHub https://github.com/grafana/xk6-browser/issues/1341#issuecomment-2129215284, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEXVMCJNGBLJGVFGQUV2R3ZD4KKPAVCNFSM6AAAAABID3FCAKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRZGIYTKMRYGQ . You are receiving this because you commented.Message ID: @.***>
Brief summary
When navigating through certain websites, in some cases an error
we either navigate top level or have old version of the navigated frame
is reported which stops the test iteration. At the moment it's not clear why this occurs, but in the investigation so far we have found that theframe
in question that is causing this panic isn't being tracked by k6 browser.There are two ways in which a new
frame
is tracked by k6 browser:We have explored the CDP requests that are made between k6 browser and chrome, but we do not see a
frameAttached
event being sent from Chrome, but we can see that theframeTree
does contain a reference to the new frame as a child.xk6-browser version
v1.5.1
OS
NA
Chrome version
NA
Docker version and image (if applicable)
NA
Steps to reproduce the problem
Run the script that is causing this issue to replicate the issue.
Expected behaviour
Script passes with no issues.
Actual behaviour
Panics with
we either navigate top level or have old version of the navigated frame
.