I have the following html:
<div class="dialog-components">
<h2 class="dialog-title">
<div class="help-link">
<a href="http://google.com">Helps</a>
</div>
Expected Result
</h2>
And I want to getText: "Expected Result". But when I tried to:
String text = driver.findElement(By.cssSelector("div.dialog-components>h2")).getText();
The text is "Helps/nExpectedResult".
How can I get my expected text result?