I am trying to write automated smoketest for an internal website. The problem is the website is almost primarily dynamically generated. So any kind of unique identifier like ID is a combination of known string prefix and ends with a radomized number.
I also can NOT depend on the order, so using things like div or span will not be reliable, UNLESS there is some way to grab the count of the span/div/input based on where I am currently located in the DOM by the KNOWN TEXT VALUE.
For example I can find the known text value. If I can somehow programatically determine that the span for this known text value is 55 , and I know that it is nested 2 deep from the other element I am looking for, then I could do something like "//span[55 - 2]/input".
The best I can do is navigate the DOM to some KNOWN text value, and work up OR down from there.
Given that, in the example below, how would I navigate to the INPUT element, when starting from the KNOWN TEXT VALUE???
<span id="RandomlyGenerated78539">KNOWN TEXT VALUE</span>
<input class="GENERIC-NON-UNIQUE" type="button" value="GENERIC-NON-UNIQUE"/>