This is probably the most straightforward exception that you will come across. The element you are trying to find does not exist. There are three common causes for this exception:
- The locator you are using to find the element is incorrect
- Something has gone wrong and the element has not been rendered
- You tried to find the element before it was rendered
The first one is pretty easy to check. You can use the Google Chrome development tools to test your locator. To do this follow these steps:
- Open the Chrome development tools (cmd + Alt + I or Ctrl + Alt + I)
- If your site has multiple frames, or iframes, make sure you select the correct frame
- Type $(<myCSSLocator>)Â or $x(<myXPathLocator>)Â into the console
If the locator finds an element, or multiple elements that match the locator, it will display it in the console. You will then...