You can use below to get the text what you want to get

//div[@class='lessthanhalf']/[contains(text(),'Load')]‌​/following::text()[1‌​] 

But doesn’t allow you to locate an element using text node. You can use JavascriptExecutor to evaluate your xpath to get your desired text

JavascriptExecutor js = (JavascriptExecutor)driver;  
Object load= js.executeScript("var value = document.evaluate("//div[@class='lessthanhalf']/strong[cont‌​ains(text(),'Load')]‌​/following::text()[1‌​]",document, null, XPathResult.STRING_TYPE, null ); return value.stringValue;"); 
System.out.println("Load Number : "+ load.toString());



Source link https://sqa.stackexchange.com/questions/31074/how-to--xpath-under--strong-br-after-every-strong

LEAVE A REPLY

Please enter your comment!
Please enter your name here