@@ -195,12 +195,14 @@ export class Page<
195
195
options ?: { button ?: MouseButton ; count ?: number } ,
196
196
) => {
197
197
await this . mouse . move ( x , y ) ;
198
+ debugPage ( `mouse click ${ x } , ${ y } ` ) ;
198
199
this . underlyingPage . mouse . click ( x , y , {
199
200
button : options ?. button || 'left' ,
200
201
count : options ?. count || 1 ,
201
202
} ) ;
202
203
} ,
203
204
wheel : async ( deltaX : number , deltaY : number ) => {
205
+ debugPage ( `mouse wheel ${ deltaX } , ${ deltaY } ` ) ;
204
206
if ( this . pageType === 'puppeteer' ) {
205
207
await ( this . underlyingPage as PuppeteerPage ) . mouse . wheel ( {
206
208
deltaX,
@@ -215,12 +217,14 @@ export class Page<
215
217
} ,
216
218
move : async ( x : number , y : number ) => {
217
219
this . everMoved = true ;
220
+ debugPage ( `mouse move to ${ x } , ${ y } ` ) ;
218
221
return this . underlyingPage . mouse . move ( x , y ) ;
219
222
} ,
220
223
drag : async (
221
224
from : { x : number ; y : number } ,
222
225
to : { x : number ; y : number } ,
223
226
) => {
227
+ debugPage ( `mouse drag from ${ from . x } , ${ from . y } to ${ to . x } , ${ to . y } ` ) ;
224
228
if ( this . pageType === 'puppeteer' ) {
225
229
await ( this . underlyingPage as PuppeteerPage ) . mouse . drag (
226
230
{
@@ -248,15 +252,17 @@ export class Page<
248
252
249
253
get keyboard ( ) {
250
254
return {
251
- type : async ( text : string ) =>
252
- this . underlyingPage . keyboard . type ( text , { delay : 80 } ) ,
253
-
255
+ type : async ( text : string ) => {
256
+ debugPage ( `keyboard type ${ text } ` ) ;
257
+ this . underlyingPage . keyboard . type ( text , { delay : 80 } ) ;
258
+ } ,
254
259
press : async (
255
260
action :
256
261
| { key : WebKeyInput ; command ?: string }
257
262
| { key : WebKeyInput ; command ?: string } [ ] ,
258
263
) => {
259
264
const keys = Array . isArray ( action ) ? action : [ action ] ;
265
+ debugPage ( 'keyboard press' , keys ) ;
260
266
for ( const k of keys ) {
261
267
const commands = k . command ? [ k . command ] : [ ] ;
262
268
await this . underlyingPage . keyboard . down ( k . key , { commands } ) ;
@@ -266,9 +272,11 @@ export class Page<
266
272
}
267
273
} ,
268
274
down : async ( key : WebKeyInput ) => {
275
+ debugPage ( `keyboard down ${ key } ` ) ;
269
276
this . underlyingPage . keyboard . down ( key ) ;
270
277
} ,
271
278
up : async ( key : WebKeyInput ) => {
279
+ debugPage ( `keyboard up ${ key } ` ) ;
272
280
this . underlyingPage . keyboard . up ( key ) ;
273
281
} ,
274
282
} ;
@@ -286,6 +294,7 @@ export class Page<
286
294
} ;
287
295
288
296
const isMac = process . platform === 'darwin' ;
297
+ debugPage ( 'clearInput begin' ) ;
289
298
if ( isMac ) {
290
299
if ( this . pageType === 'puppeteer' ) {
291
300
// https://github.com/segment-boneyard/nightmare/issues/810#issuecomment-452669866
@@ -307,6 +316,7 @@ export class Page<
307
316
await this . underlyingPage . keyboard . up ( 'Control' ) ;
308
317
await backspace ( ) ;
309
318
}
319
+ debugPage ( 'clearInput end' ) ;
310
320
}
311
321
312
322
private everMoved = false ;
@@ -371,6 +381,7 @@ export class Page<
371
381
}
372
382
373
383
async navigate ( url : string ) : Promise < void > {
384
+ debugPage ( `navigate to ${ url } ` ) ;
374
385
if ( this . pageType === 'puppeteer' ) {
375
386
await ( this . underlyingPage as PuppeteerPage ) . goto ( url ) ;
376
387
} else if ( this . pageType === 'playwright' ) {
0 commit comments