@@ -270,7 +270,7 @@ LocatorBuilders.prototype.preciseXPath = function(xpath, e) {
270
270
// order listed dictates priority
271
271
// e.g., 1st listed is top priority
272
272
273
- LocatorBuilders . add ( 'css:data-attr' , function ( e ) {
273
+ LocatorBuilders . add ( 'css:data-attr' , function cssDataAttr ( e ) {
274
274
const dataAttributes = [ 'data-test' , 'data-test-id' ]
275
275
for ( let i = 0 ; i < dataAttributes . length ; i ++ ) {
276
276
const attr = dataAttributes [ i ]
@@ -282,14 +282,14 @@ LocatorBuilders.add('css:data-attr', function(e) {
282
282
return null
283
283
} )
284
284
285
- LocatorBuilders . add ( 'id' , function ( e ) {
285
+ LocatorBuilders . add ( 'id' , function id ( e ) {
286
286
if ( e . id ) {
287
287
return 'id=' + e . id
288
288
}
289
289
return null
290
290
} )
291
291
292
- LocatorBuilders . add ( 'linkText' , function ( e ) {
292
+ LocatorBuilders . add ( 'linkText' , function linkText ( e ) {
293
293
if ( e . nodeName == 'A' ) {
294
294
let text = e . textContent
295
295
if ( ! text . match ( / ^ \s * $ / ) ) {
@@ -301,18 +301,18 @@ LocatorBuilders.add('linkText', function(e) {
301
301
return null
302
302
} )
303
303
304
- LocatorBuilders . add ( 'name' , function ( e ) {
304
+ LocatorBuilders . add ( 'name' , function name ( e ) {
305
305
if ( e . name ) {
306
306
return 'name=' + e . name
307
307
}
308
308
return null
309
309
} )
310
310
311
- LocatorBuilders . add ( 'css:finder' , function ( e ) {
311
+ LocatorBuilders . add ( 'css:finder' , function cssFinder ( e ) {
312
312
return 'css=' + finder ( e )
313
313
} )
314
314
315
- LocatorBuilders . add ( 'xpath:link' , function ( e ) {
315
+ LocatorBuilders . add ( 'xpath:link' , function xpathLink ( e ) {
316
316
if ( e . nodeName == 'A' ) {
317
317
let text = e . textContent
318
318
if ( ! text . match ( / ^ \s * $ / ) ) {
@@ -329,7 +329,7 @@ LocatorBuilders.add('xpath:link', function(e) {
329
329
return null
330
330
} )
331
331
332
- LocatorBuilders . add ( 'xpath:img' , function ( e ) {
332
+ LocatorBuilders . add ( 'xpath:img' , function xpathImg ( e ) {
333
333
if ( e . nodeName == 'IMG' ) {
334
334
if ( e . alt != '' ) {
335
335
return this . preciseXPath (
@@ -363,7 +363,7 @@ LocatorBuilders.add('xpath:img', function(e) {
363
363
return null
364
364
} )
365
365
366
- LocatorBuilders . add ( 'xpath:attributes' , function ( e ) {
366
+ LocatorBuilders . add ( 'xpath:attributes' , function xpathAttr ( e ) {
367
367
const PREFERRED_ATTRIBUTES = [
368
368
'id' ,
369
369
'name' ,
@@ -415,7 +415,7 @@ LocatorBuilders.add('xpath:attributes', function(e) {
415
415
return null
416
416
} )
417
417
418
- LocatorBuilders . add ( 'xpath:idRelative' , function ( e ) {
418
+ LocatorBuilders . add ( 'xpath:idRelative' , function xpathIdRelative ( e ) {
419
419
let path = ''
420
420
let current = e
421
421
while ( current != null ) {
@@ -443,7 +443,7 @@ LocatorBuilders.add('xpath:idRelative', function(e) {
443
443
return null
444
444
} )
445
445
446
- LocatorBuilders . add ( 'xpath:href' , function ( e ) {
446
+ LocatorBuilders . add ( 'xpath:href' , function xpathHref ( e ) {
447
447
if ( e . attributes && e . hasAttribute ( 'href' ) ) {
448
448
let href = e . getAttribute ( 'href' )
449
449
if ( href . search ( / ^ h t t p ? : \/ \/ / ) >= 0 ) {
@@ -470,7 +470,10 @@ LocatorBuilders.add('xpath:href', function(e) {
470
470
return null
471
471
} )
472
472
473
- LocatorBuilders . add ( 'xpath:position' , function ( e , opt_contextNode ) {
473
+ LocatorBuilders . add ( 'xpath:position' , function xpathPosition (
474
+ e ,
475
+ opt_contextNode
476
+ ) {
474
477
let path = ''
475
478
let current = e
476
479
while ( current != null && current != opt_contextNode ) {
@@ -490,7 +493,7 @@ LocatorBuilders.add('xpath:position', function(e, opt_contextNode) {
490
493
return null
491
494
} )
492
495
493
- LocatorBuilders . add ( 'xpath:innerText' , function ( el ) {
496
+ LocatorBuilders . add ( 'xpath:innerText' , function xpathInnerText ( el ) {
494
497
if ( el . innerText ) {
495
498
return `xpath=//${ el . nodeName . toLowerCase ( ) } [contains(.,'${ el . innerText } ')]`
496
499
} else {
0 commit comments