Had heard of it but never tried it my self till today, when a colleague asked about selenium being capable of recording http traffic or not.
Did a little Google and found that Selenium 1.0 has api - "captureNetweokTraffic" in DefaultSelenium class, and then needed to know how to use it. To be able to capture network traffic one should start selenium instance as -
Did a little Google and found that Selenium 1.0 has api - "captureNetweokTraffic" in DefaultSelenium class, and then needed to know how to use it. To be able to capture network traffic one should start selenium instance as -
selenium.start("captureNetworkTraffic=true");
and then launch the application usual way. Once you reach a point after which n/w traffic is to be captured then fire following method -
selenium.captureNetworkTraffic("xml");
We can pass - "xml", "plain" or "json" as parameter to this method. Since its return type is String, we can assert presence of any specific request on the response received
Though had some trouble while using captureNetworkTraffic, At times I would encounter Internal Server Error from selenium. Or then expected response string will not be available in String returned by captureNetworkTraffic, Though would always see same available from fire bug. But yet on the whole "captureNetworkTraffic" helped in achieving what I wanted to do.
Comments
Post a Comment
No spam only genuine comments :)