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:

  1. the element ids randomized.
  2. the order inner text inside span tags randomized.
  3. 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

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -