Re: Testing Web Analytics with Selenium WebDriver

4,453 views
Skip to first unread message

Arran

unread,
Mar 27, 2013, 10:46:48 AM3/27/13
to seleniu...@googlegroups.com
What value in particular is it? Your GA ID? Where in the Console is it displayed? No, trying to use the Console with WebDriver is never going to work (although might do using ChromeDriver2?).

Are you sure that value isn't actually in the page source somewhere? Or is it accessible using Javascript?

If not, why don't you modify your environment to print out the value to a better, more accessible place, such as a hidden div.

On Wednesday, 27 March 2013 12:48:59 UTC, ES wrote:
Hi All,

I am trying to test google analytics withSelenium WebDriver. Manually on the console of the developer's mode (F12) the GA tag is recorded. Using automation I am trying to capture

F12 button

Console of the developer window

assert the details of the GA tag. 

However I do not have any success. Any guidance is much appreciated.

David Lai

unread,
Mar 27, 2013, 1:53:24 PM3/27/13
to seleniu...@googlegroups.com
You won't be able to automate the developer's console using selenium.  But you can run JS code to get at the variables in the GA script.

G_tester

unread,
Apr 12, 2013, 5:19:42 AM4/12/13
to seleniu...@googlegroups.com
Hi ES,

I am also facing the same issue. the tracking contents are seen on Console
but are not available in page source

Please share the details in case if you have found answers and able to work
with Google Analytics?

Thanks,




--
View this message in context: http://selenium.10932.n7.nabble.com/Testing-Web-Analytics-with-Selenium-WebDriver-tp22515p23301.html
Sent from the Selenium - Users mailing list archive at Nabble.com.

Dan Franko

unread,
Apr 12, 2013, 10:34:41 AM4/12/13
to seleniu...@googlegroups.com
Maybe the way to approach it is to query the analytics api as opposed to trying to capture these things on the client side?

Mark Collin

unread,
Apr 14, 2013, 12:08:08 PM4/14/13
to seleniu...@googlegroups.com

It kind of depends upon what you want to do, I would personally just look for the presence of the GA script:

 

//script[contains(@src,'google-analytics.com/ga.js')]

 

If you want to check that it is actually sending events over to google when certain things happen you heading into proxy territory.

 

From: seleniu...@googlegroups.com [mailto:seleniu...@googlegroups.com] On Behalf Of ES
Sent: 27 March 2013 12:49
To: seleniu...@googlegroups.com
Subject: [selenium-users] Testing Web Analytics with Selenium WebDriver

 

Hi All,

 

I am trying to test google analytics withSelenium WebDriver. Manually on the console of the developer's mode (F12) the GA tag is recorded. Using automation I am trying to capture

 

F12 button

 

Console of the developer window

 

assert the details of the GA tag. 

 

However I do not have any success. Any guidance is much appreciated.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/TXtFWWdPLb8J.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Vikram

unread,
Oct 26, 2017, 3:36:56 PM10/26/17
to Selenium Users
Hi All,

Anyone using Selenium for fully testing web analytics or any other open source framework please share.

Thanks,
Vikram

Vikram

unread,
Nov 11, 2017, 4:29:52 AM11/11/17
to Selenium Users
Hi All,

After some google searches, found below 2 interesting projects

https://github.com/janexner/site-infrastructure-tests

https://github.com/joaolcorreia/WAUnit

Is somebody using one of these ? I've some basic queries to clarify.

Thanks in advance.

Regards,
Vikram

Vikram

unread,
Nov 22, 2017, 9:09:20 AM11/22/17
to Selenium Users
Hi All,

I've made some progress on this front so wanted to share back with community


1. My company uses Google Tag Manager for web analytics

https://stackoverflow.com/questions/23640645/what-is-the-difference-between-google-tag-manager-and-google-analytics


2. If your project also uses GTM then this solution works for you as well

   Call GTM script with Selenium Driver & parse data returned by GTM object

   https://stackoverflow.com/questions/47411742/how-to-trigger-google-tag-manager-script-from-java-code


3. Next challenge is how to keep data analytics, marketing, dev and qa in sync while doing this testing

While researching for solution I found few other frameworks. Will explain merits and demerits of each one of them

1.  https://github.com/sahava/gtm-datalayer-test/

-  It's in Javascript thus didn't try out


2.  https://github.com/janexner/site-infrastructure-tests


-  Looks good but documentation is quite confusing and not clear at many places
-  No support from the author even after filing quite a few issues on GH repo


3.  https://github.com/anandbagmar/WAAT

- Not useful at all
- This was presented in recent selenium conference but it needs lots of customization and currently can be used on Android platform only

Regards,
Vikram

⇜Krishnan Mahadevan⇝

unread,
Nov 22, 2017, 9:15:53 AM11/22/17
to seleniu...@googlegroups.com

Vikram

Perhaps you could blog about this capturing all this in your post and share it.

Blogs are easier to collate info and easier for updating as well.

You could post the blog url here.


--

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

Vikram

unread,
Nov 22, 2017, 10:16:58 AM11/22/17
to Selenium Users
Hey Krishnan,

I'm planning to upload project on github once I'm fully done with this task.

currently struggling to find out where bugs in analytics are happening and which is resulting my company wasting loads of money on marketing and not tracking results properly.

Regards,
Vikram

Vikram

unread,
Jan 1, 2018, 3:54:30 AM1/1/18
to Selenium Users
Dear All,

Wish you  a very happy and prosperous new year 2018

I've completed Web Analytics ( Google Analytics ) automation using Serenity and BDD approach, you can find it below.

https://github.com/vikramvi/WebAnalyticsAutomationWithSerenity


I hope you will find it useful for your project as well.

Regards,
Vikram
Reply all
Reply to author
Forward
0 new messages