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

libGdx unable to find files in android application data directory -

php - Webix Data Loading from Laravel Link -

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