Summary:
I'm doing some automation testing for a webapp (using Selenium), and I'm trying to capture a mailto:link (specifically one of its query parameters) that gets generated by javascript during an onclick event. Currently the only way I can think of to do this is to duplicate the logic into my test function. This is not ideal because it means I'll have to update the logic in the tests if it ever changes in the webapp. My question is: can you think of a better way?
Details:
Here's how the webapp is working:
- listen for click event on a div
- if the event's target is the "email button" generate a mailto: URI based on current state
- set
window.location = [generated URI]
in JavaScript
Unfortunately, as you can see, this URI generation happens as a result of an onclick event and just sets the window.location to that URI, so it's not setting it as an href attribute on an anchor (or any attribute on any other) element that I can query the DOM for.
I also haven't had any luck finding an event that fires as a result of the window.location
being set to a mailto: URI that might have the URI as one of its properties... am I maybe forgetting one?
Any ideas?