html - What XPath to select only non-taged text inside div. Selenium. Java -


i want select text "only text" snipet below using xpath (in java) text random , don't know written there.

 <div class="a">     <input id="button" type="button">x</input>     random text  </div> 

what simplest xpath?

 //div[@class='a'][what next?] 

i saw similar questions answers complicated , know simplest way.

also there other way, without using xpath (in java),to text?

thanks.

you can select text nodes using axis step text().

//div[@class='a']/text() 

if want text nodes following <input/> node, use this:

//div[@class="a"]/input/following-sibling::text() 

you can add arbitrary predicates <input/> element, - did <div/>.


Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -