After clicking the add to cart button on your product page, Robot Ninja confirms the product was added to the cart in a couple of ways:

  • If your store has the Redirect to the cart page after successful addition option enabled found under WooCommerce > Settings > Products. Robot Ninja will make sure the cart page was loaded.
  • If you store doesn't redirect to the cart page, Robot Ninja will look for the notice to say the product has been added to the cart. 

However, if your store redirects the customer straight to the checkout then you will need to use our custom selectors feature to add support for this.

How to use custom selectors to confirm the user has successfully redirected to the checkout?

If you already have a custom CSS selector you'd like to use to confirm the user has landed on the checkout page after successfully adding a product to the cart then please skip to step 4.

1. Open Chrome, Firefox or Safari (or any other browser with developer tools) and go to your stores shop page or a single product page and add a product to the cart.

2. (should be on the checkout page) Right click on any element on the page which indicates a product was successfully added to the cart

3. Find a Class, ID, XPath or CSS selector for the chosen element
(for example CSS = .woocommerce-checkout-review-order td.product-name).

4. Set the custom selector for "Product successfully added to cart" in Robot Ninja by going to Store > Settings > Selectors from the Dashboard.

5. Click the update button and queue up your tests again 🥳

Other helpful links


How to tell if the failed test can be fixed using a custom selector?

The screenshot attached to the test will show you where the test ended up at time of failure. The first thing to do would be to check the screenshot to see if a product was in the cart and has landed on the checkout page.

If the screenshot shows the checkout page, then this indicates that Robot Ninja is looking for the wrong element and custom selectors will fix the issue.

Did this answer your question?