using xpath document.querySelector

9,339 views
Skip to first unread message

darker-fear

unread,
May 11, 2013, 10:17:25 AM5/11/13
to casp...@googlegroups.com
Hello

i don't know if someone tested xpath with querySelector, but it doesnt work with me

document.querySelector('plop').textContent = 'test';    // This one Work
document.querySelector(x('//*[@id="plop"]')).textContent = 'test';  // This one not Working

Any ideas ?

Nicolas Perriault

unread,
May 11, 2013, 12:25:57 PM5/11/13
to casp...@googlegroups.com
On Sat, May 11, 2013 at 4:17 PM, darker-fear <hsn.e...@gmail.com> wrote:

> Any ideas ?

document.querySelector{All}() is a browser native function which
doesn't support XPath, only CSS3 selectors.

Use __utils__.getElement{s}ByXpath()
http://docs.casperjs.org/en/latest/modules/clientutils.html#getelementbyxpath

++

--
Nicolas Perriault
https://nicolas.perriault.net/
Phone: +33 (0) 660 92 08 67

darker-fear

unread,
May 12, 2013, 5:32:25 PM5/12/13
to casp...@googlegroups.com
Thanks Nicolas 

 __utils__.getElement{s}ByXpath()  worked like a charm for me.


Regards
Reply all
Reply to author
Forward
0 new messages