Skip to content Skip to sidebar Skip to footer

Passing A Variable Into An XPath Expression In CasperJS

I am using CasperJS to do some browser automation. Now I have an array, which contains text that can be found on some buttons that are randomly generated on the page. I pick a rand

Solution 1:

Just used string concatenation to build the selector:

var selector = "\'//*[text()=\"" + pickedButton + "\"]\'";

this.click(x(selector));

Post a Comment for "Passing A Variable Into An XPath Expression In CasperJS"