Selenium WebDriver by xpath: search by text in child elements -


i using selenium webdriver. (java, if matters).

i need find element, searching, among other things, text under subordinate element. looping through list of elements , comparing gettext() value want, suspect better let browser through xpath.

for example, here element want find:

<span role="button" class="mbltoolbarbutton mbltoolbarbuttonhasleftarrow" tabindex="0" id="dojox_mobile_toolbarbutton_3" dir="ltr" widgetid="dojox_mobile_toolbarbutton_3"><span class="mbltoolbarbuttonarrow mbltoolbarbuttonleftarrow mblcolordefault mblcolordefault45"></span><span class="mbltoolbarbuttonbody mblcolordefault"><table cellpadding="0" cellspacing="0" border="0" role="presentation" class="mbltoolbarbuttontext"><tbody><tr><td class="mbltoolbarbuttonicon"></td><td class="mbltoolbarbuttonlabel">back</td></tr></tbody></table></span></span> 

after searching online tried following selector:

//*[contains(@class,'mbltoolbarbuttonhasleftarrow') , text()[contains(.,'back')]] 

but did not work.

ideally search entire text, not substring, element text "back" found, similar element text "backup" not found. don't need concatenate text in different child elements.

what selector should write? thanks!

are looking below?

//*[text()='back']/ancestor::*[@class='mbltoolbarbutton mbltoolbarbuttonhasleftarrow']


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -