0

I am very curious to know how does firepath finds a unique xpath locator with in seconds as soon as we click on element. I know how to query xpath using firepath, but what I want to know that which language or technology has been used to developed such tools and what if I have to develop similar kind of tool. I have seen many automation tool have develop with such tools where when we click on page it will generate unique xpath locator, it makes me to curious and I want to know in depth how does things works in back end.

  1. When I open DOM in developer tool it was so confusing.
  2. How they identify element on click?
  3. Is it rocket science?
  4. Do they user JavaScript, JQuery or any other programing language?
  5. Do we have any apis which can be use?
Karim Narsindani
  • 434
  • 3
  • 14
  • 38

1 Answers1

0

type this in console and click somewhere) so it's the answer

document.addEventListener('click', function(event){console.log(event.target)});
Vitaliy Moskalyuk
  • 2,463
  • 13
  • 15
  • Thanks Vitaliy, I tried this but not happen, steps I follow. 1. I have type above given js in console -> Run and click on page... nothing happens. Do I have to follow any other steps – Karim Narsindani Jul 05 '17 at 17:22
  • I have found the github for this project as it is open source, but I don't know in which IDE I can open it https://github.com/pierretholence/firepath – Karim Narsindani Jul 05 '17 at 17:23
  • i just explained how it works) To get clicked element you can simply use evenListeners in javascipt to get click target element) – Vitaliy Moskalyuk Jul 05 '17 at 19:39
  • `document.addEventListener("click", function(e){ document.getElementById("demo").innerHTML = e.target});` written in script tag and then I was able to get the element Thanks!!! – Karim Narsindani Jul 19 '17 at 18:41