Can any one tell me the css selector for this expression: -
xpath = a[contains(text(),'dbfsbdj')]
i have tried a:contains('dbfsbdj') - invalid ?
you can't select element text content css.
if want use javascript, (jsfiddle):
var paragraphs = document.getelementsbytagname('p'); [].slice.call(paragraphs).foreach(function(p) { if(p.textcontent.indexof('world') > -1) { console.log(p); } }); // => <p>world</p>
html:
<p>hello</p> <p>world</p>
you make little function this:
var paragraphs = document.getelementsbytagname('p'); console.log(contains(paragraphs, 'world')); // => [<p>world</p>] function contains(_elements, text) { var elements = []; [].slice.call(_elements).foreach(function(p) { if(p.textcontent.indexof('world') > -1) { elements.push(p); } }); return elements; }
Comments
Post a Comment