XPath is a language on it’s own and it’s very powerfull indeed my young padawan 🙂 . XPath allows you to find specific Elements inside XML (and in our case also XHTML) documents.
This in fact, means that before we can actually do things in our Browser, we need to find the elements via XPath so that we can influence (Click, Select, Type in, …) them.
Luckily there are free tools out there that can help us generate Xpath. Right clicking an element in Chrome will allow you to select the XPath.
- First right click the element you want the Xpath for, then click “inspect”.
- The console window will open: right click the highlighted area.
- Click “Copy”, then “Copy Xpath”
In your clipboard you will now have the Xpath for your selected element. For example:
You can now use this Xpath together with Selenium in C# to influence the element.
You must be logged in to post a comment.