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


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


Please enter your comment!
Please enter your name here