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

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -