Skip to content

Commit 13c2a4b

Browse files
committed
name all locator functions
1 parent a95fbda commit 13c2a4b

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

packages/selenium-ide/src/content/locatorBuilders.js

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ LocatorBuilders.prototype.preciseXPath = function(xpath, e) {
270270
// order listed dictates priority
271271
// e.g., 1st listed is top priority
272272

273-
LocatorBuilders.add('css:data-attr', function(e) {
273+
LocatorBuilders.add('css:data-attr', function cssDataAttr(e) {
274274
const dataAttributes = ['data-test', 'data-test-id']
275275
for (let i = 0; i < dataAttributes.length; i++) {
276276
const attr = dataAttributes[i]
@@ -282,14 +282,14 @@ LocatorBuilders.add('css:data-attr', function(e) {
282282
return null
283283
})
284284

285-
LocatorBuilders.add('id', function(e) {
285+
LocatorBuilders.add('id', function id(e) {
286286
if (e.id) {
287287
return 'id=' + e.id
288288
}
289289
return null
290290
})
291291

292-
LocatorBuilders.add('linkText', function(e) {
292+
LocatorBuilders.add('linkText', function linkText(e) {
293293
if (e.nodeName == 'A') {
294294
let text = e.textContent
295295
if (!text.match(/^\s*$/)) {
@@ -301,18 +301,18 @@ LocatorBuilders.add('linkText', function(e) {
301301
return null
302302
})
303303

304-
LocatorBuilders.add('name', function(e) {
304+
LocatorBuilders.add('name', function name(e) {
305305
if (e.name) {
306306
return 'name=' + e.name
307307
}
308308
return null
309309
})
310310

311-
LocatorBuilders.add('css:finder', function(e) {
311+
LocatorBuilders.add('css:finder', function cssFinder(e) {
312312
return 'css=' + finder(e)
313313
})
314314

315-
LocatorBuilders.add('xpath:link', function(e) {
315+
LocatorBuilders.add('xpath:link', function xpathLink(e) {
316316
if (e.nodeName == 'A') {
317317
let text = e.textContent
318318
if (!text.match(/^\s*$/)) {
@@ -329,7 +329,7 @@ LocatorBuilders.add('xpath:link', function(e) {
329329
return null
330330
})
331331

332-
LocatorBuilders.add('xpath:img', function(e) {
332+
LocatorBuilders.add('xpath:img', function xpathImg(e) {
333333
if (e.nodeName == 'IMG') {
334334
if (e.alt != '') {
335335
return this.preciseXPath(
@@ -363,7 +363,7 @@ LocatorBuilders.add('xpath:img', function(e) {
363363
return null
364364
})
365365

366-
LocatorBuilders.add('xpath:attributes', function(e) {
366+
LocatorBuilders.add('xpath:attributes', function xpathAttr(e) {
367367
const PREFERRED_ATTRIBUTES = [
368368
'id',
369369
'name',
@@ -415,7 +415,7 @@ LocatorBuilders.add('xpath:attributes', function(e) {
415415
return null
416416
})
417417

418-
LocatorBuilders.add('xpath:idRelative', function(e) {
418+
LocatorBuilders.add('xpath:idRelative', function xpathIdRelative(e) {
419419
let path = ''
420420
let current = e
421421
while (current != null) {
@@ -443,7 +443,7 @@ LocatorBuilders.add('xpath:idRelative', function(e) {
443443
return null
444444
})
445445

446-
LocatorBuilders.add('xpath:href', function(e) {
446+
LocatorBuilders.add('xpath:href', function xpathHref(e) {
447447
if (e.attributes && e.hasAttribute('href')) {
448448
let href = e.getAttribute('href')
449449
if (href.search(/^http?:\/\//) >= 0) {
@@ -470,7 +470,10 @@ LocatorBuilders.add('xpath:href', function(e) {
470470
return null
471471
})
472472

473-
LocatorBuilders.add('xpath:position', function(e, opt_contextNode) {
473+
LocatorBuilders.add('xpath:position', function xpathPosition(
474+
e,
475+
opt_contextNode
476+
) {
474477
let path = ''
475478
let current = e
476479
while (current != null && current != opt_contextNode) {
@@ -490,7 +493,7 @@ LocatorBuilders.add('xpath:position', function(e, opt_contextNode) {
490493
return null
491494
})
492495

493-
LocatorBuilders.add('xpath:innerText', function(el) {
496+
LocatorBuilders.add('xpath:innerText', function xpathInnerText(el) {
494497
if (el.innerText) {
495498
return `xpath=//${el.nodeName.toLowerCase()}[contains(.,'${el.innerText}')]`
496499
} else {

0 commit comments

Comments
 (0)