Learning Objectives
Review
New Test Project
AJAX testing
Using `
text()
` in XPathUsing the parent node in Xpath to be more specific
Test Case 13
Please note this is a public site (which I don’t have control of, different from Agile Travel), so the site may change.
Tasks
Task 1. Click the “Sign In”
Right-click the “Sign In” and inspect.
This is not a hyperlink (`<a href
`), we cannot use the LINK_TEXT
locator. Within the identified `SPAN
` tag, there are no easy identifiers such as ID, NAME, or even a good attribute for identification.
<button data-qa="web-toolbar#signin-button">
<span class="psw-fill-x psw-t-truncate-1 psw-l-space-x-2 ">Sign In</span>
</button>
The element’s classes `psw-fill-x`
are all quite generic, i.e., which are used by many other elements, so we can’t use them.
Therefore, this leads to the natural thought to use the text `Sign In
`. We can use it in XPath as below.
Keep reading with a 7-day free trial
Subscribe to AgileWay’s Test Automation & Continuous Testing Blog to keep reading this post and get 7 days of free access to the full post archives.