How To Get Text From Nested Span Tag In Selenium
I have below HTML code in my project. I have to find only the text 'One Way'. I have tried below codes but it is returning 'One Way Tab 1 of 2'. I am new in selenium so not sure
Solution 1:
findElement(By.xPath("/button/span[contains(., 'One Way')]").getText()
Could you try finding the element using XPath, as above, to see if that returns correctly?
Post a Comment for "How To Get Text From Nested Span Tag In Selenium"