"browsingContext.captureScreenshot" doesn't fail with NoSuchFrameError if tab gets removed while command is executed
Categories
(Remote Protocol :: WebDriver BiDi, defect, P3)
Tracking
(Not tracked)
People
(Reporter: whimboo, Unassigned)
References
(Blocks 2 open bugs)
Details
(Whiteboard: [webdriver:backlog])
Seen while investigating bug 1841125. When we do not await the response for the browsingContext.captureScreenshot
command and the tab the screenshot is created of is closed immediately the command returns a generic error instead of a no such frame
error:
0:14.12 pid:52136 1688370080720 RemoteAgent DEBUG WebDriverBiDiConnection 2f88219d-094f-40fb-995f-6ca3c90cd730 <- {"id":3,"error":"unknown error","message":"TypeError: can't access property \"browsingContext\", win is null","stacktrace":"capture.canvas@chrome://remote/content/shared/Capture.sys.mjs:79:17\ncaptureScreenshot@chrome://remote/content/webdriver-bidi/modules/root/browsingContext.sys.mjs:123:39\n"}
The Wdspec test that can be used to reproduce this issue is:
async def test(bidi_session, inline):
new_tab = await bidi_session.browsing_context.create(type_hint='tab')
page = inline("""<div>foo</div""")
await bidi_session.browsing_context.navigate(
context=new_tab["context"], url=page, wait="complete")
await bidi_session.send_command("browsingContext.captureScreenshot", {
"context": new_tab["context"],
})
await bidi_session.browsing_context.close(context=new_tab["context"])
await bidi_session.browsing_context.create(type_hint="tab")
This might be a problem in general for all the commands that take long enough. Given that BiDi is async we cannot expect anymore that when the initial check for the browsing context passes, we will also have it later on. Another client or via another session the tab could have been closed.
We probably should add tests like the above for all the commands to make sure that the correct error is returned.
Updated•1 year ago
|
Comment 1•1 year ago
|
||
The severity field is not set for this bug.
:whimboo, could you have a look please?
For more information, please visit BugBot documentation.
Reporter | ||
Updated•1 year ago
|
Description
•