rem: LocatorBuilders.add('attributesXPath', function(e) { const PREFERRED_ATTRIBUTES = ['id','name','value','type','action','onclick'];  function attributesXPath(name, attNames, attributes) { var locator = " for (var i = 0; i < attNames.length; i++) { if (i > 0) { locator += " and "; } var attName = attNames[i]; locator += '@' + attName + "=" + this.attributeValue(attributes[attName]); } locator += "]"; return locator; }  if (e.attributes) { var atts = e.attributes; var attsMap = {}; for (var i = 0; i < atts.length; i++) { var att = atts[i]; attsMap[att.name] = att.value; } var names = [];  for (var i = 0; i < PREFERRED_ATTRIBUTES.length; i++) { var name = PREFERRED_ATTRIBUTES[i]; if (attsMap[name] != null) { names.push(name); var locator = attributesXPath.call(this, e.nodeName.toLowerCase(), names, attsMap); if (e == this.findElement(locator)) { return locator; } } } } 
add: LocatorBuilders.add('imgXPath', function(e) { if (e.nodeName == 'IMG') { if (e.alt != '') { return " } else if (e.src != '') { return " } } 
context: LocatorBuilders.add('attributesXPath', function(e) {		const PREFERRED_ATTRIBUTES = ['id','name','value','type','action','onclick'];				function attributesXPath(name, attNames, attributes) {			var locator = "//" + name + "[";			for (var i = 0; i < attNames.length; i++) {				if (i > 0) {					locator += " and ";				}				var attName = attNames[i];				locator += '@' + attName + "=" + this.attributeValue(attributes[attName]);			}			locator += "]";			return locator;		}		if (e.attributes) {			var atts = e.attributes;			var attsMap = {};			for (var i = 0; i < atts.length; i++) {				var att = atts[i];				attsMap[att.name] = att.value;			}			var names = [];			// try preferred attributes			for (var i = 0; i < PREFERRED_ATTRIBUTES.length; i++) {				var name = PREFERRED_ATTRIBUTES[i];				if (attsMap[name] != null) {					names.push(name);					var locator = attributesXPath.call(this, e.nodeName.toLowerCase(), names, attsMap);					if (e == this.findElement(locator)) {						return locator;					}				}			}		}		return null;	});
meta: 3428	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/3428/c2cf93982c5109588ee388232629f4472d0fba4b/locatorBuilders.js/buggy/src/content/locatorBuilders.js