Currently, I am in the process of automating Google Analytics testing using Selenium WebDriver Java bindings on our website. The site is equipped with Google Analytics tracking events attached to key elements, and my goal is to confirm that clicking a specific element triggers the corresponding Google Analytic event.
This assessment is being conducted on FireFox. Upon inspecting the console by pressing F12, I can observe that each click event on an element results in a Google Analytics message reading
GET http://www.google-analytics.com/__utm.gif
.
Here is a sample code snippet:
WebDriver wd = new FirefoxDriver();
wd.get("http://www.dummyExample.com/");
wd.findElement(By.linkText("Document Referece")).click();
wd.findElement(By.id("Ex2vc2")).click();
To accomplish this task successfully, I have attempted to search for solutions online without much luck. Any guidance, references, or sample code provided would be greatly appreciated.