I'm trying to use XPath to find an element containing text, but I am not able to get it.
I used the below code:
WebElement searchItemByText = driver.findElement(By.xpath("//*[@id='popover-search']/div/div/ul/li[1]/a/span[contains(text()='Some text')]"));
If I remove the last bit with the "contains" thing, it locates my span element, but I need to select it based on the text contents. It's not gonna be a perfect match of 'Some text' either because it might contain truncated strings as well.
plzz tell me the issue