Time for action - finding elements by XPath
Unfortunately, best practices cannot always be followed when building the markup, or if they are, they may have a dynamic edge to them. An example of this would be working against a page that uses a key from the database as the element ID. So when something is edited and stored back in the database, it can be found a lot quicker and updated. In this section of the chapter, we are going to work with XPath. XPath allows us to query the DOM as though it were an XML document. With XPath we can do some rather complex queries to find elements on the page that may not have been accessible otherwise.
Let's start by creating a basic XPath. We are going to look for an input button.
- Open the Selenium IDE.