java - Selenium says invalid xpath for span -


html :

<div class="accept"><a class="red_keep popup_action"><span>click here view terms</span></a></div> 

xpath have tried :

1. //span[text()='click here view terms'] 2. normalize-space(//href[@class="red_keep popap_action"]/text()='click here view terms') 

from above xpath none of them working.

assuming need match span text content after spaces normalized (using normalized-space()), xpath can 1 of following :

//span[normalized-space(text())='click here view terms'] //span[text()[normalized-space(.)='click here view terms']] 

the first xpath works if target text node first child node of span, while second xpath should work regardless.


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -