I'm creating automated tests, using Selenium and Python, and I need a way to check what events are being sent. So for instance, when a user is successfully logged in, an event is sent and I want to be able to quickly check that the event ID is correct without having to manually open the Adobe Experience Platform Debugger extension.
Solved! Go to Solution.
Views
Replies
Total Likes
I solved this by using Selenium-wire. Then I have access to the requests.
for request in driver.requests: # Iterate through network requests
query = request.querystring.replace('&', ' ') # Replace ampersand with space
query = query.split() # Split on space into a list of requests
for items in query: # Iterate through items in query
if "events" in items: # If the word "events" is in an item
items = items.replace('%3D', '=') # Replace unicode '=' with '='
items = items.replace('%2C', ' ') # Replace unicode ',' with space
items = items.replace('%3A', ':') # Replace unicode ':' with ':'
items = items.split() # Split on space into a list of events
for e in items: # Iterate through the list of events
if "events=" in e: # Strip "events=" label
e = e.replace('events=', '')
event_list.append(e) # Append the event to the event list
Hi,
I think an easy way to verify this is by examining the Adobe Datalayer object, which is populated in the Window object. This object will be filled with the events that are being triggered. You would need to collaborate with a developer or someone from analytics to confirm the event names you need to check.
Thanks for the reply, Esteban. I can handle confirming the event names to check, but do you know how I can access the Adobe Datalayer object with an automated test with Python?
Sorry, I am not a Selenium dev, but perhaps some of the below can give you some inputs:
https://stackoverflow.com/questions/55096220/window-object-from-selenium-webdriver-is-empty-array
I solved this by using Selenium-wire. Then I have access to the requests.
for request in driver.requests: # Iterate through network requests
query = request.querystring.replace('&', ' ') # Replace ampersand with space
query = query.split() # Split on space into a list of requests
for items in query: # Iterate through items in query
if "events" in items: # If the word "events" is in an item
items = items.replace('%3D', '=') # Replace unicode '=' with '='
items = items.replace('%2C', ' ') # Replace unicode ',' with space
items = items.replace('%3A', ':') # Replace unicode ':' with ':'
items = items.split() # Split on space into a list of events
for e in items: # Iterate through the list of events
if "events=" in e: # Strip "events=" label
e = e.replace('events=', '')
event_list.append(e) # Append the event to the event list
Views
Likes
Replies