Skip to content
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

Implement ElementHandle.screenshot([options]) #2

Closed
robingustafsson opened this issue Sep 30, 2021 · 1 comment
Closed

Implement ElementHandle.screenshot([options]) #2

robingustafsson opened this issue Sep 30, 2021 · 1 comment
Labels
feature A new feature playwright Issue relating to Playwright compatibility

Comments

@robingustafsson
Copy link
Member

robingustafsson commented Sep 30, 2021

Add support for ElementHandle.screenshot([options]), to allow screenshots of individual elements.

Relevant links:

@robingustafsson robingustafsson added feature A new feature playwright Issue relating to Playwright compatibility labels Sep 30, 2021
inancgumus added a commit that referenced this issue Nov 3, 2021
* Reverts changes
* Refactors the code
* Removes the ineffective map creation in clearLifecycle
* Adds debugging information when a Frame becomes nil
@robingustafsson
Copy link
Member Author

Closing, implemented as part of #80

@robingustafsson robingustafsson changed the title Implement ElementHandle.screenshot([options]) Implement ElementHandle.screenshot([options]) Nov 12, 2021
inancgumus added a commit that referenced this issue Jun 13, 2023
This fixes an issue where we try to create a new page while in that time
frame the context gets canceled. This happens when we detach from a
page, but does not close a context.

This requires us not to close browser contexts manually. Or, we can do a
better fix like actually managing the order of CDP events as noted at
the link below.

grafana/k6-cloud#1096 (comment)

Example:
---> [2023-06-13 11:13:53.943147 +0300 +03 m=+0.261837668] {"id":24,"sessionId":"A3583375BA7F32AAEAB9C1AC2CBDE91F","method":"Target.closeTarget","params":{"targetId":"A97C871B24EDA407A73456BD66F3BB38"}}
<- [2023-06-13 11:13:53.943205 +0300 +03 m=+0.261896084] {"id":3,"result":{},"sessionId":"51CC05417CBCD9D6C53FFE1415C69FC7"}
---> [2023-06-13 11:13:53.943224 +0300 +03 m=+0.261915293] {"id":4,"sessionId":"51CC05417CBCD9D6C53FFE1415C69FC7","method":"Page.getFrameTree"}
<- [2023-06-13 11:13:53.943652 +0300 +03 m=+0.262342834] {"method":"Target.detachedFromTarget","params":{"sessionId":"51CC05417CBCD9D6C53FFE1415C69FC7","targetId":"A97C871B24EDA407A73456BD66F3BB38"}}
<- [2023-06-13 11:13:53.943726 +0300 +03 m=+0.262417168] {"method":"Target.detachedFromTarget","params":{"sessionId":"A3583375BA7F32AAEAB9C1AC2CBDE91F","targetId":"A97C871B24EDA407A73456BD66F3BB38"}}
---> [2023-06-13 11:13:53.943764 +0300 +03 m=+0.262455084] {"id":4,"method":"Target.createTarget","params":{"url":"about:blank","browserContextId":"499FDE1E341CE49A7ABA692E29D37E77"}}
<- [2023-06-13 11:13:53.943788 +0300 +03 m=+0.262478543] {"method":"Target.detachedFromTarget","params":{"sessionId":"CE16D33D3A4F5D6DCE96ECF82FA2F816","targetId":"A97C871B24EDA407A73456BD66F3BB38"}}
<- [2023-06-13 11:13:53.945993 +0300 +03 m=+0.264683584] {"method":"Target.attachedToTarget","params":{"sessionId":"A1D8B7A6D5B35C6E70B42AAF51C52651","targetInfo":{"targetId":"65F36539B0283566B7B1E2402F1A04D6","type":"page","title":"","url":"","attached":true,"canAccessOpener":false,"browserContextId":"499FDE1E341CE49A7ABA692E29D37E77"},"waitingForDebugger":true}}
---> [2023-06-13 11:13:53.946108 +0300 +03 m=+0.264799501] {"id":1,"sessionId":"A1D8B7A6D5B35C6E70B42AAF51C52651","method":"Network.enable","params":{}}
<- [2023-06-13 11:13:53.946128 +0300 +03 m=+0.264818668] {"method":"Target.attachedToTarget","params":{"sessionId":"686322F7BD5A465B1EFE15FEDD1B6E14","targetInfo":{"targetId":"65F36539B0283566B7B1E2402F1A04D6","type":"page","title":"","url":"","attached":true,"canAccessOpener":false,"browserContextId":"499FDE1E341CE49A7ABA692E29D37E77"},"waitingForDebugger":true}}
---> [2023-06-13 11:13:53.946257 +0300 +03 m=+0.264948501] {"id":1,"sessionId":"686322F7BD5A465B1EFE15FEDD1B6E14","method":"Network.enable","params":{}}
<- [2023-06-13 11:13:53.946316 +0300 +03 m=+0.265007376] {"id":4,"error":{"code":-32001,"message":"Session with given id not found."}}
<- [2023-06-13 11:13:53.946328 +0300 +03 m=+0.265018626] {"method":"Target.attachedToTarget","params":{"sessionId":"CD89C89BC60C581FC739971DAAA61C06","targetInfo":{"targetId":"65F36539B0283566B7B1E2402F1A04D6","type":"page","title":"","url":"","attached":true,"canAccessOpener":false,"browserContextId":"499FDE1E341CE49A7ABA692E29D37E77"},"waitingForDebugger":true}}
    browser_test.go:258:
                Error Trace:    /Users/inanc/grafana/k6browser/main/tests/browser_test.go:258
                Error:          Received unexpected error:
                                creating new page in browser context: creating a new blank page: Session with given id not found. (-32001)
                Test:           TestMultiConnectToSingleBrowser
                Messages:       failed to create page #2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new feature playwright Issue relating to Playwright compatibility
Projects
None yet
Development

No branches or pull requests

1 participant