the responsehandler is called with the first row in the spreadsheet but with subsequent rows the responsehandler is not called.
Settings testSettings = new Settings();
testSettings.Web.UseHttpProxy = true;
Manager mgr = new Manager(testSettings);
try
{
mgr.Start();
ResponseListenerInfo li = new ResponseListenerInfo(ResponseHandler);
Debug.WriteLine("instantiated listener");
mgr.Http.AddBeforeResponseListener(li);
Debug.WriteLine("added listener");
mgr.LaunchNewBrowser(BrowserType.InternetExplorer, true);
url = string.Format("http://{0}{1}", domain, Data["url"]);
mgr.ActiveBrowser.NavigateTo(url);
mgr.ActiveBrowser.WaitUntilReady();
mgr.Http.RemoveBeforeResponseListener(li);
// System.Threading.Thread.Sleep(3000);
mgr.ActiveBrowser.Close();
// li=null;
}
catch(Exception e){
Debug.WriteLine(string.Format("error {0}",e.Message));
}
finally
{
mgr=null;
Debug.WriteLine("finally");
System.Threading.Thread.Sleep(5000);
}
}
private void ResponseHandler(object sender, HttpResponseEventArgs e)
{
Debug.WriteLine(string.Format("{0} - {1}", e.Response.Request.RequestUri,e.Response.StatusCode));
int[] codes=new int[]{301,302,303,304,305,306,307};
if (codes.Contains<int>(e.Response.StatusCode)){
Assert.IsTrue(false);
}
System.Collections.Specialized.NameValueCollection headers = e.Response.Headers;
if (url == e.Response.Request.RequestUri )
{
//some are reported as soft but they are real pages.
if (e.Response.StatusCode != 200)
{
Assert.IsTrue(ArtOfTest.Common.CompareUtils.StringCompare(e.Response.StatusCode.ToString(), "404",
FindCompareType.Exact));
}
}
}
Settings testSettings = new Settings();
testSettings.Web.UseHttpProxy = true;
Manager mgr = new Manager(testSettings);
try
{
mgr.Start();
ResponseListenerInfo li = new ResponseListenerInfo(ResponseHandler);
Debug.WriteLine("instantiated listener");
mgr.Http.AddBeforeResponseListener(li);
Debug.WriteLine("added listener");
mgr.LaunchNewBrowser(BrowserType.InternetExplorer, true);
url = string.Format("http://{0}{1}", domain, Data["url"]);
mgr.ActiveBrowser.NavigateTo(url);
mgr.ActiveBrowser.WaitUntilReady();
mgr.Http.RemoveBeforeResponseListener(li);
// System.Threading.Thread.Sleep(3000);
mgr.ActiveBrowser.Close();
// li=null;
}
catch(Exception e){
Debug.WriteLine(string.Format("error {0}",e.Message));
}
finally
{
mgr=null;
Debug.WriteLine("finally");
System.Threading.Thread.Sleep(5000);
}
}
private void ResponseHandler(object sender, HttpResponseEventArgs e)
{
Debug.WriteLine(string.Format("{0} - {1}", e.Response.Request.RequestUri,e.Response.StatusCode));
int[] codes=new int[]{301,302,303,304,305,306,307};
if (codes.Contains<int>(e.Response.StatusCode)){
Assert.IsTrue(false);
}
System.Collections.Specialized.NameValueCollection headers = e.Response.Headers;
if (url == e.Response.Request.RequestUri )
{
//some are reported as soft but they are real pages.
if (e.Response.StatusCode != 200)
{
Assert.IsTrue(ArtOfTest.Common.CompareUtils.StringCompare(e.Response.StatusCode.ToString(), "404",
FindCompareType.Exact));
}
}
}