java - XPATH - How to get text from a webpage? -


i need select particulr text webpage using xpath. text looks below

the "add account offer" request has been submitted order number css_334560. 

in above line need "css_334560" using xpath. can me here?

html :-

<div id="secondcolumn" class="floatbreaker"> <div id="maincontents"> <h1>add account offers                     </h1> <div class="infobox"> <div class="topline"> <div class="txtlineright"> <div class="txtlineleft"> <div class="txt"> <span>the "add account offer" request has been submitted order number css_334560.</span> </div> </div> 

you can use following code if use java:

string = driver.findelement(by.xpath("//div[@class='txt']/span")).gettext();  = a.substring(a.lastindexof(' ') + 1).replace(".", ""); 

first row gets text span. second row takes css_334560. , removes dot.

html code not full, can't guaranty xpath correct.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -