I need to verify the text of a popover field (using Katalon Recorder) and as per Inspect Element, it tells me it’s id=“popover851352” but that number immediately following “popover” changes every time it is run. Is there something else I can use for the Target? Or is there a Wildcard way of using that for the target (id=popover* did not work).
See pictures attached.
NOTE - I have found that I can use the class=popover-body for now, but could run into a problem with that if there is more than one popover on screen at the time, so I’d still like to know if there is a way to use the id rather than the class.
You should not stick to the id.
You can use XPath to select a list of HTML elements with a class. You can choose an element in the list by its
position() (1, 2, 3, …). For example,
The highlighted XPath expression means:
- Within the 4th
<tr> element in the page, select a list of
<td> elements with
class="foo"; the list may contain multiple elements; hopefully more than or equal to 3.
- among the list, choose the 3rd
<td class="foo"> element.
On the Internet, there are a few read about XPath with position(); for example
There are problems with XPath, though, in that it expects the popover to be in a certain position - and these popovers can appear anywhere on screen. I did try using the Target Selector (which gave me the ID with its current number) and copying the XPath after inspecting the element and neither worked.
Even though the popup may appear anywhere on the screen, it’s likely the HTML has the helptip at the end of the page.
You might be able to create a pathway to your helptip, or your popover, by starting your path at the popover warning class, and then to the div and then to your message.
Like: xpath =