jQuery ":contains()" analog for pure JS
casperjs, html, javascript, jquery, phantomjs
Solution
Since 0.6.8, CasperJS offers XPath support, so you can write something like this:
var x = require('casper').selectXPath;
casper.then(function() {
this.click(x('//span[text()="1"]'))
})
Hope this helps.
Problem
I'm writing a script for CasperJS. I need to click on the link that contains a span with "1". In jQuery can be used `:contains('1')`, but what the solution is for selectors in pure Javascript? HTML: `<a class="swchItem"><span>1</span></a><a class="swchItem"><span>2</span></a>` jQuery variant: `$('a .swchItem span:contains("1")')` UPD CasperJS code: ``` casper.then(function () { this.click('a .swchItem *select span with 1*') }) ```