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

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -