AndreeaFed AndreeaFed - 2 years ago 221
AngularJS Question

Angular JS - How to find the element in DOM having the xpath?

How can I use xpath instead of id to find the element in DOM. I know that for id I can use:


I use
inside Developer mode in browser in order to get the element by id to see what methods (like
or others) am I able to use for the element. I want to know how to do this by XPATH

Thanks in advance

Answer Source

On Firefox console you can find (and explore) the element like this:


But if you want to call a function on the element, you have to call it like this:


because there is always an array of elements returned (provided that the element is present and the first one in the array).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download