July 2019
Intermediate to advanced
536 pages
12h 57m
English
Getting back to dynamic elements created during tests, how are they handled? We wouldn't want to define them upfront, and cannot possibly define them upfront, due to the nature of the dynamic names, text, or IDs associated with them.
So, let's build a method that takes a string parameter that defines some element in a page, which will get stuffed into an XPath locator on the fly. For this example, let's use a page's label elements.
To test all the //label elements in a web page—and in some cases, there can be dozens—we would want to store the labels in a data file and pass them into a test method one at a time, verifying that they exist on the page. To do this, we have to build the locator on the fly, as ...
Read now
Unlock full access