fix(mcp): await init page before screenshot#41646
Conversation
| const screenshotTargetLabel = params.target ? params.element || 'element' : (params.fullPage ? 'full page' : 'viewport'); | ||
| const target = params.target ? await tab.targetLocator({ element: params.element, target: params.target }) : null; | ||
| if (!target) | ||
| await tab.waitForInitialized(); |
There was a problem hiding this comment.
I think it should be earlier in the pipeline, most likely in the context.ensureTab
There was a problem hiding this comment.
Good call — ensureTab is the right place. That way all tools (snapshot, evaluate, screenshot, etc.) get the guarantee automatically instead of each one having to remember to await init. I will move the waitForInitialized() call into context.ensureTab() and keep the method on Tab for direct use when needed.
Per review feedback, await tab.waitForInitialized() in context.ensureTab() so all tools benefit from waiting for init-page scripts to complete, not just screenshot. Keep waitForInitialized() on Tab for direct use when needed.
|
Moved |
|
@microsoft-github-policy-service agree |
This comment has been minimized.
This comment has been minimized.
|
@yury-s CI follow-up: the previous red checks looked unrelated to this patch ( |
This comment has been minimized.
This comment has been minimized.
|
The remaining red MCP job looks unrelated to this PR ( Could someone approve/rerun the workflows when convenient? |
|
@yury-s sorry for the extra ping — the refreshed MCP workflow is running now, but one unrelated shard has gone red again ( |
Test results for "MCP"4 failed 7731 passed, 1248 skipped Merge workflow run. |
Summary
browser_take_screenshotwith--init-pageFixes #41650