Null Pointer Exception in test

I’m getting a null pointer exception in my test. The steps that run are all built-in (although there are some plugins later)

Here’s the null pointer exception message:

I’ll put the test that’s failing in a comment.

This was working fine and suddenly was throwing exceptions about 3 days ago.

Here’s the internal test:

It seems to find the component it’s looking for and then crash.

Hi @alebahn and welcome to our community :slight_smile: ,

Some websites use HTML generation frameworks. These frameworks will often create identifiers that change every time the page is loaded. These are known as dynamic element locators and can be quite tricky to deal with in UI test automation.

It seems to be some issue with the locators of the element.

  1. First, try to edit the element like in the image below,


To check your locators use the magnifying glass
(notice the element must be present on the page when checking a locator):

If another locator is more consistent make it your primary locator, push it to the top with the arrows next to the magnifying glass.

  1. Check for a unique attribute and search the button by that locator,

you can make your custom locator like this for example:
using Xpath //*[@attribute="value"]

For instance, my locator for Amazon looks like this:
using Xpath //*[@id="add-to-cart-button"]

However, you can use TestProject built-in locator generator like this:

by pressing double shift on any element you can freeze it and then extract multiple XPath

You also can find more information on dynamic locators here:

Let me know if you managed.

This topic was automatically closed after 180 days. New replies are no longer allowed.