haimlit
haimlit

Reputation: 2582

How to test google analytics with Selenium on my app?

I would like to test google analytics and see that it works properly (see that events are tracked when appropriate with the appropriate parameters, etc..). What would be the best approach to do it? Can Selenium do something like expect for certain REST calls and make sure they happened?

Upvotes: 0

Views: 3149

Answers (1)

Robbie Wareham
Robbie Wareham

Reputation: 3428

You could integrate a proxy such Browsermob into your tests. This would allow you to perform actions on the web page with Selenium then query the proxy via its API to assert that the correct calls were made and with the correct values.

Here is a link explaining how to block analytics using Browsermob but should still be a good background to approach your problem;

https://sqa.stackexchange.com/questions/6859/how-do-you-block-google-analytics-from-selenium-automated-visits

Upvotes: 1

Related Questions