0

Invalid selector: Unable to locate an element with the XPath expression:

//span[@class='title-subGrid-lite-TextAutoEllipsis’][text()[contains(.,'My Emails')]

Correct me.

2
  • post some sample input please? Commented Nov 28, 2018 at 10:07
  • //span[@class='title-subGrid-lite-TextAutoEllipsis' and contains(.,'My Emails')] are tou looking for this? Commented Nov 28, 2018 at 10:10

1 Answer 1

2

This error message...

org.openqa.selenium.InvalidSelectorException: invalid selector: Unable to locate an element with the xpath expression //span[@class='title-subGrid-lite-TextAutoEllipsis’][text()[contains(.,'My Emails')]

...implies that the XPath which you have used was not a valid one.

The xpath expression you have used as follows have a couple of issues:

//span[@class='title-subGrid-lite-TextAutoEllipsis’][text()[contains(.,'My Emails')]
  • The class attribute needs to be properly placed in-between single quotes i.e. '...'.
  • The text attribute needs to be properly placed in-between [...]

The simple XPath expression which must have catered to your requirement is:

//span[@class='title-subGrid-lite-TextAutoEllipsis'][contains(.,'My Emails')]

As an alternative you can also try:

//span[@class='title-subGrid-lite-TextAutoEllipsis' and contains(.,'My Emails')]

Perhaps you must be looking for:

//span[@class='title-subGrid-lite-TextAutoEllipsis'][normalize-space()='My Emails']
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.