@@ -58,11 +58,11 @@ export const click = definePageTool({
5858 dblClick : dblClickSchema ,
5959 includeSnapshot : includeSnapshotSchema ,
6060 } ,
61- handler : async ( request , response , context ) => {
61+ handler : async ( request , response ) => {
6262 const uid = request . params . uid ;
6363 const handle = await request . page . getElementByUid ( uid ) ;
6464 try {
65- await context . waitForEventsAfterAction ( async ( ) => {
65+ await request . page . waitForEventsAfterAction ( async ( ) => {
6666 await handle . asLocator ( ) . click ( {
6767 count : request . params . dblClick ? 2 : 1 ,
6868 } ) ;
@@ -97,9 +97,9 @@ export const clickAt = definePageTool({
9797 dblClick : dblClickSchema ,
9898 includeSnapshot : includeSnapshotSchema ,
9999 } ,
100- handler : async ( request , response , context ) => {
100+ handler : async ( request , response ) => {
101101 const page = request . page ;
102- await context . waitForEventsAfterAction ( async ( ) => {
102+ await page . waitForEventsAfterAction ( async ( ) => {
103103 await page . pptrPage . mouse . click ( request . params . x , request . params . y , {
104104 clickCount : request . params . dblClick ? 2 : 1 ,
105105 } ) ;
@@ -130,11 +130,11 @@ export const hover = definePageTool({
130130 ) ,
131131 includeSnapshot : includeSnapshotSchema ,
132132 } ,
133- handler : async ( request , response , context ) => {
133+ handler : async ( request , response ) => {
134134 const uid = request . params . uid ;
135135 const handle = await request . page . getElementByUid ( uid ) ;
136136 try {
137- await context . waitForEventsAfterAction ( async ( ) => {
137+ await request . page . waitForEventsAfterAction ( async ( ) => {
138138 await handle . asLocator ( ) . hover ( ) ;
139139 } ) ;
140140 response . appendResponseLine ( `Successfully hovered over the element` ) ;
@@ -217,7 +217,6 @@ async function fillFormElement(
217217 }
218218}
219219
220- // here
221220export const fill = definePageTool ( {
222221 name : 'fill' ,
223222 description : `Type text into a input, text area or select an option from a <select> element.` ,
@@ -236,7 +235,7 @@ export const fill = definePageTool({
236235 } ,
237236 handler : async ( request , response , context ) => {
238237 const page = request . page ;
239- await context . waitForEventsAfterAction ( async ( ) => {
238+ await page . waitForEventsAfterAction ( async ( ) => {
240239 await fillFormElement (
241240 request . params . uid ,
242241 request . params . value ,
@@ -262,9 +261,9 @@ export const typeText = definePageTool({
262261 text : zod . string ( ) . describe ( 'The text to type' ) ,
263262 submitKey : submitKeySchema ,
264263 } ,
265- handler : async ( request , response , context ) => {
264+ handler : async ( request , response ) => {
266265 const page = request . page ;
267- await context . waitForEventsAfterAction ( async ( ) => {
266+ await page . waitForEventsAfterAction ( async ( ) => {
268267 await page . pptrPage . keyboard . type ( request . params . text ) ;
269268 if ( request . params . submitKey ) {
270269 await page . pptrPage . keyboard . press (
@@ -290,13 +289,13 @@ export const drag = definePageTool({
290289 to_uid : zod . string ( ) . describe ( 'The uid of the element to drop into' ) ,
291290 includeSnapshot : includeSnapshotSchema ,
292291 } ,
293- handler : async ( request , response , context ) => {
292+ handler : async ( request , response ) => {
294293 const fromHandle = await request . page . getElementByUid (
295294 request . params . from_uid ,
296295 ) ;
297296 const toHandle = await request . page . getElementByUid ( request . params . to_uid ) ;
298297 try {
299- await context . waitForEventsAfterAction ( async ( ) => {
298+ await request . page . waitForEventsAfterAction ( async ( ) => {
300299 await fromHandle . drag ( toHandle ) ;
301300 await new Promise ( resolve => setTimeout ( resolve , 50 ) ) ;
302301 await toHandle . drop ( fromHandle ) ;
@@ -334,7 +333,7 @@ export const fillForm = definePageTool({
334333 handler : async ( request , response , context ) => {
335334 const page = request . page ;
336335 for ( const element of request . params . elements ) {
337- await context . waitForEventsAfterAction ( async ( ) => {
336+ await page . waitForEventsAfterAction ( async ( ) => {
338337 await fillFormElement (
339338 element . uid ,
340339 element . value ,
@@ -415,12 +414,12 @@ export const pressKey = definePageTool({
415414 ) ,
416415 includeSnapshot : includeSnapshotSchema ,
417416 } ,
418- handler : async ( request , response , context ) => {
417+ handler : async ( request , response ) => {
419418 const page = request . page ;
420419 const tokens = parseKey ( request . params . key ) ;
421420 const [ key , ...modifiers ] = tokens ;
422421
423- await context . waitForEventsAfterAction ( async ( ) => {
422+ await page . waitForEventsAfterAction ( async ( ) => {
424423 for ( const modifier of modifiers ) {
425424 await page . pptrPage . keyboard . down ( modifier ) ;
426425 }
0 commit comments