feat: respond with action and generated locator (#181)
Closes https://github.com/microsoft/playwright-mcp/issues/163
This commit is contained in:
parent
4d59e06184
commit
4a19e18999
10 changed files with 126 additions and 52 deletions
|
|
@ -35,6 +35,7 @@ const navigate: ToolFactory = captureSnapshot => ({
|
|||
const currentTab = await context.ensureTab();
|
||||
return await currentTab.run(async tab => {
|
||||
await tab.navigate(validatedParams.url);
|
||||
return `await page.goto('${validatedParams.url}');`;
|
||||
}, {
|
||||
status: `Navigated to ${validatedParams.url}`,
|
||||
captureSnapshot,
|
||||
|
|
@ -54,6 +55,7 @@ const goBack: ToolFactory = snapshot => ({
|
|||
handle: async context => {
|
||||
return await context.currentTab().runAndWait(async tab => {
|
||||
await tab.page.goBack();
|
||||
return `await page.goBack();`;
|
||||
}, {
|
||||
status: 'Navigated back',
|
||||
captureSnapshot: snapshot,
|
||||
|
|
@ -73,6 +75,7 @@ const goForward: ToolFactory = snapshot => ({
|
|||
handle: async context => {
|
||||
return await context.currentTab().runAndWait(async tab => {
|
||||
await tab.page.goForward();
|
||||
return `await page.goForward();`;
|
||||
}, {
|
||||
status: 'Navigated forward',
|
||||
captureSnapshot: snapshot,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue