Forum Discussion

rwestbury's avatar
rwestbury
Contributor
11 years ago

Possible to detect HTTP POST and HTTP GET requests from the Browser?

Hello all,



We are in need of something like the following:



Sys.Browser.Page.MyButton.Click()

httpPostRequest = waitForHttpPostRequest(maxWaitTime = 10ms)

if httpPostRequest then waitForHttpGetRequest(maxWaitTime = 120000ms)

waitForPageToLoad()



The reason we need this is because, after the Click(), in theory an HTTP POST request should either be sent immediately, or never, as a result of the Click(). Therefore if it's not sent within 10ms return False, otherwise return True as soon as an HTTP POST request is detected. If an HTTP POST request is detected, then wait for an HTTP GET request for up to 2 minutes. An HTTP GET request should be sent within a few seconds, so now the page is definitely loading, therefore it's now safe to wait for the page to finish loading.



Fiddler has the ability to monitor such things. I'm hoping TestComplete has something built in for this to help us deal with these random delays that occur between Click() and the page actually loading.



Thanks,



Robert

2 Replies

  • Anyone have any ideas?



    Really we're looking for a way to hook into the Browser and monitor the HTTP GET/POST requests like Fiddler does to make our testing more robust.



    Thanks,



    Robert
  • maximojo's avatar
    maximojo
    Frequent Contributor
    Hi



    We asked Smartbear support about basically what you're asking (except for requests made by flash swfs). Their reply was there is nothing directly built-in to TestComplete to handle this. They mentioned tools you already know:



    http://www.fiddlertool.com/Fiddler2/

    http://www.wireshark.org/



    However, our thought (though we haven't implemented this) was to make plugins to one of those tools which output the requests to e.g. a file, and then read that file in though a TestComplete script plugin. Perhaps you could pass a filter string to the TestComplete plugin which would only get the get/posts you needed (as I'm sure you noticed when you look at the requests made by a PC there's a lot of junk that pops up from random places depending on what web pages you have open).



    So e.g. you might initialize your TestComplete plugin with the string "*.google.com" so that you would only see strings related to google.



    That's one idea for you :)