I have this html :
<div class="b-datalist__item__subj">
hello
<span class="b-datalist__item__subj__snippet">hello world</span>
</div>
And I want to get only "hello" text, without "hello world". I write this code:
subject = this.driver.findElement(By.xpath("//div[@class = 'b-datalist__item__subj']")).getText();
But in console output I see "hellohello world". How can I fix it?
//div[@class = 'b-datalist__item__subj']/text()will find the text node, I think.