selenium - Find XPath with known value using c# -
i attempting write automated smoketest internal corporate website using c# , selenium webdriver.
the problem website dynamically generated using lot of dojo javascript. contains frames , popups. o_o
so everytime page loaded normal element attributes randomized , never consistently same.
the order randomized.
the known constant inner text contained within these tags.
example 1 (initial page load):
<div id="23"> <span id="random40">known text one</span> <span id="random41">known text two</span> <span id="random42">known text three</span> </div>
example 2 (subsequent page load):
<div id="random 11"> <span id="random45">known text three</span> <span id="random46">known text one</span> <span id="random43">known text two</span> </div>
as can see in examples above:
- the element ids randomized.
- the order inner text inside span tags randomized.
- the inner text inside span tags consistently same.
with being randomized , order changing how can programatically parse dom, find text value, , determine xpath once found?
knowing text enough since, once found element text:
//span[. = "known text one"]
you can go up, down , sideways using different axes.
Comments
Post a Comment