Hello,
Sorry in advance if I didn't format this correctly, first time poster.
I'm currently working on developing tests to read omniture tags being sent from websites to Site Catalyst database. Most of these calls occur on page load or through certain button clicks i.e. "add to cart" and must have their data captured and verified after going through a proxy. Based on previous forum posts I've been able to build a coded module that has Telerik start a proxy, then goes to the site, then checks the calls for the host under which the omniture call is made and captures that data.
My problem occurs whenever there are multiple calls that happen from the same button. Currently I can only capture 1 call, and it's random which one will fire first, so I need to be able to see both, capture both, then check if the values are correct.
I've attached the following:
HTTP proxy module I built that starts the proxy and also contains methods to click on certain buttons and listen for the calls then returns a dictionary
The Dictionary Lookup module defines methods that allow the us to compare key value pairs in the dictionary with our asserts.
WebTest(1) which puts all these steps together.
Below is the method I use to click on the "add to cart" button and wait for an omniture to be made and stores the data in a dictionary and returns it. I feel like this is what I need to modify in order to capture two calls instead of just one.
public Dictionary<string, string> ClickAddToCartButtonAndListen()
{
found = false;
Console.WriteLine("Omniture Url: " + omnitureUrl); //DEBUGGING
// Add our HTTP response event handler. For each response the proxy gets, parse for the Omniture URL's query string parameters
ResponseListenerInfo li = new ResponseListenerInfo(GetQueryStringParamatersAndValues);
Manager.Current.Http.AddBeforeResponseListener(li);
// Click 'Add to Cart Button'
Pages.OfficialVailVailLift.Button.Click(false);
// Wait for the page to completely load
Manager.Current.ActiveBrowser.Frames.WaitAllUntilReady();
Manager.Current.ActiveBrowser.WaitUntilReady();
Manager.Current.ActiveBrowser.WaitForAjax(15000);
// Wait for '1000' msec. (this is to conpensate for the Omniture pixel being one of the last things called
System.Threading.Thread.Sleep(1000);
// We don't need the event handler any longer. Removing it stops listening to responses in the proxy
Manager.Current.Http.RemoveBeforeResponseListener(li);
return dictionary;
}