JavaScript generate an result array from XPATH

This is a function in JavaScript that use an XPATH string to generate an Array from the results.This is very useful if you have to manipulate or use some items on a page and don’t have the id(like bots).

That is the function:

You could use it in the Terminal:

And we get all hrefs on this page in the Terminal:

Use it to store it in an Array and then write it on the page:

and we got this result:

10 thoughts on “JavaScript generate an result array from XPATH”

  1. Hey! I know this is kind of off topic but I
    was wondering which blog platform are you using for this site?
    I’m getting tired of WordPress because I’ve had issues with hackers and I’m looking at alternatives for another
    platform. I would be great if you could point me in the
    direction of a good platform.

    View Comment
  2. I do consider all of the concepts you have introduced for your post.
    They’re really convincing and can definitely work.
    Nonetheless, the posts are too quick for starters. May you please prolong
    them a little from next time? Thank you for the post.

    View Comment
  3. Ahaa, its fastidious discussion concerning this paragraph at this place at this weblog, I have read all that, so at this time me also commenting here.

    View Comment
  4. I do trust all the ideas you’ve presented for your post.
    They are really convincing and will certainly work.

    Nonetheless, the posts are too short for newbies. May just you please extend
    them a little from next time? Thank you for the post.

    View Comment
  5. Your style is unique compared to other people I have read
    stuff from. I appreciate you for posting when you have the opportunity, Guess I will just bookmark this site.

    View Comment
  6. Heya i’m for the first time here. I found this board and I to find It truly
    useful & it helped me out much. I’m hoping to provide
    one thing again and aid others such as you helped me.

    View Comment

Leave a Reply

Your email address will not be published.

7 + seven =