I have this code:
HtmlPage rowPage = ...
String address1 = ((HtmlDivision)rowPage.getFirstByXPath("//div[contains(@class, 'client_address1')]")).asXml();
System.out.println("address1 = " address1);
String address1_2 = ((HtmlDivision)rowPage.getFirstByXPath("//div[contains(@class, 'client_address1')]")).asNormalizedText();
System.out.println("address1_2 = " address1_2);
and my output is:
address1 = <div >
123 Somewhere ln
</div>
address1_2 =
I expect asNormalizedText()
to return 123 Somewhere ln
. What circumstances would cause asNormalizedText
to return nothing?
CodePudding user response:
A bit more specific XPath would help
//div[contains(@class, 'client_address1')]/text()