Every line of 'get element by attribute javascript' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
37 function getElementWithAttribute(attribute) 38 { 39 var allElements = document.getElementsByTagName('*'); 40 for (var i = 0, n = allElements.length; i < n; i++) 41 if (allElements[i].getAttribute(attribute) !== null) 42 return allElements[i]; 43 return null; 44 }
228 function getElementByAttributeValue(attribName, value) 229 { 230 return getDocumentElementByAttributeValue(document, attribName, value); 231 }
124 function getByAttr(tag, attr, value) { 125 return document.querySelector(tag + '[' + attr + '="' + value + '"]'); 126 }
16 export function getElement(el: FinderResult): ElementFinder { 17 return typeof el === 'string' ? element(by.css(el)) : el; 18 }
29 function getValue(selector) { 30 return browser.executeScript(` 31 return $('${selector}').val(); 32 `); 33 }
47 getAttribute(name) { 48 if (name == "style") { 49 return this.root.getAttribute("style"); 50 } 51 return this[ATTRIBUTE_SYMBOL][name] 52 }
99 function valueFromElement(el) { 100 switch(el.getAttribute('type')) { 101 case 'radio': 102 return el.checked ? el.value : null 103 case 'checkbox': 104 return 'data', el.checked 105 } 106 return el.value 107 }
42 getAttribute (name) { 43 return this[ATTRIBUTE_SYMBOL][name] 44 }