Find node from known starting point in totally dynamic webpage using c# and XPath? -
i trying write automated smoketest internal website. problem website dynamically generated. kind of unique identifier id combination of known string prefix , ends radomized number.
i can not depend on order, using things div[2] or span[25] not reliable, unless there way grab count of span/div/input based on located in dom known text value.
for example can find known text value. if can somehow programatically determine span known text value 55 , , know nested 2 deep other element looking for, "//span[55 - 2]/input".
the best can navigate dom known text value, , work or down there.
given that, in example below, how navigate input element, when starting known text value???
<span id="randomlygenerated35673"> <span id="randomlygeneratednum58532"> <span id="randomlygenerated78539"> <span/> <span/> <span id="randomlygenerated78539">known text value</span> </span> </span> <input class="generic-non-unique" type="button" value="generic-non-unique"/> </span>
you can use following
axis:
//span[. = 'known text value']/following::input[@type = 'button']
Comments
Post a Comment