Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

selenium
selenium xpath
debugging

How to resolve InvalidSelectorException in Selenium

Educative Answers Team

Selenium allows users to extract a particular element from within the webpage using selectors. The InvalidSelectorException or the org.openqa.selenium.InvalidSelectorException: invalid selector error occurs when the XPATH added is not valid.

svg viewer

Solution

  • Recheck the punctuations such as @, ', and [].
  • Ensure that there is only one field name with that path; else, use the contains() method.

RELATED TAGS

selenium
selenium xpath
debugging
Copyright ©2022 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses

Keep Exploring