MCPcopy Create free account
hub / github.com/ChromeDevTools/chrome-devtools-mcp / createNewPageAndTriggerDialog

Function createNewPageAndTriggerDialog

tests/index.test.ts:266–293  ·  view source on GitHub ↗
(client: Client)

Source from the content-addressed store, hash-verified

264
265 describe('Dialogs', () => {
266 async function createNewPageAndTriggerDialog(client: Client) {
267 // Navigate to a page with a button that triggers a dialog on click
268 await client.callTool({
269 name: 'new_page',
270 arguments: {
271 url: `data:text/html,<button id="test" onclick="alert('test dialog')">Click me</button>`,
272 },
273 });
274
275 const snapshotResult = await client.callTool({
276 name: 'take_snapshot',
277 arguments: {},
278 });
279
280 const snapshotText = (snapshotResult.content as TextContent[])[0].text;
281 const match = snapshotText.match(/uid=(\d+_\d+)\s+button "Click me"/);
282 const uid = match ? match[1] : '1_1';
283
284 // Trigger the dialog
285 const result = await client.callTool({
286 name: 'click',
287 arguments: {
288 uid,
289 },
290 });
291
292 return result;
293 }
294
295 it('returns blocked message when dialog is opened during tool execution', async t => {
296 await withClient(async client => {

Callers 1

index.test.tsFile · 0.85

Calls 1

matchMethod · 0.80

Tested by

no test coverage detected