I want to extract the text "Hi, Harvey " from the below html source
<div shop-menu">
<ul clas="navbar-nav">
::before
"Hi, harvey "
<a href="logout.htm">..</a>
::after
</ul>
</div>
</div>
I have tried:
driver.findElement(By.linkText("Hi, harvey "))
but couldn't extract it, any suggestions?
CodePudding user response:
This should locate that element
driver.findElement(By.xpath("//ul[contains(.,'Hi, harvey')]"))