I know many QA did http traffic testing manually by 2 famous software:
1) HTTPWatch: commercial. support both IE and Foxfox.
2) HTTPFox: free, opensource. a Firefox extension.
One day, a guy came to my cube and raised a question: Can I stop my tons of manual functional testing with HttpFox, but use Selenium to automate them? Is it possible that we create a bundle of Selenium APIs to manuplate Http Traffic Sniffer operations?
Yes, we should add this important feature to Selenium. I finished a beta version to support HttpFox APIs in Selenium:
1) merge httpfox.xpi into Selenium-IDE.xpi
2) leverage XPCOM in httpfoxservice.js HTTPFox provided
3) create Selenium APIs and print http traffic info to Selenium LOG:
startHttpFox4Sel
stopHttpFox4Sel
clearHttpFox4Sel
verifyTextInHttpFoxURLs(Not)Present | textpattern
verifyTextInHttpFoxContent(Not)Present | urlpattern | textpattern
storeContentInHttpFoxByURL | urlpattern | varname
verifyParamInHttpFoxQueryString(Not)Present | urlpattern | param1=value1,param2=value2 list
storeParamInHttpFoxQueryString | param@urlpattern | varname
verifyParamInHttpFoxPostData(Not)Present | urlpattern | param1=value1,param2=value2 list
storeParamInHttpFoxPostData | param@urlpattern | varname
...
Source draft:
Selenium.prototype.doStartHttpFox4Sel = function() { try { if(browserVersion.isChrome){ HttpFox.cmd_hf_clear(); HttpFox.cmd_hf_startWatching(); } } catch (e) { throw new SeleniumError("Threw an exception: " + e.message); } }; Selenium.prototype.doStopHttpFox4Sel = function() { try { if(browserVersion.isChrome){ HttpFox.cmd_hf_stopWatching(); HttpFox.cmd_hf_clear(); } } catch (e) { throw new SeleniumError("Threw an exception: " + e.message); } }; Selenium.prototype.doClearHttpFox4Sel = function() { try { if(browserVersion.isChrome){ HttpFox.cmd_hf_clear(); } } catch (e) { throw new SeleniumError("Threw an exception: " + e.message); } }; Selenium.prototype.isTextInHttpFoxURLsPresent = function(pattern) { try { if(browserVersion.isChrome){ for (var i = 0; i < HttpFox.HttpFoxService.Requests.length; i++){ var request = HttpFox.HttpFoxService.Requests[i]; //1.Time: var time = formatTimeDifference(request.StartTimestamp, request.EndTimestamp) ; //2.Sent: var sent = ""; if (request.IsSending){ sent = humanizeSize(request.getBytesSent(), 6) + "/" + humanizeSize(request.getBytesSentTotal(), 6); } else { sent = humanizeSize(request.getBytesSentTotal(), 6); } //3.Received: var received = ""; if (request.IsSending){ received = "*"; } if (!request.IsFinished){ // show loading body progress received = humanizeSize(request.getBytesLoaded(), 6) + "/" + humanizeSize(request.getBytesLoadedTotal(), 6); }else{ received = humanizeSize(request.getBytesLoaded(), 6); } if (request.IsFromCache || request.ResponseStatus == 304){ received = "(" + received + ")"; } //4.Method: var method = request.RequestMethod; //5.Result: var result = ""; if (request.IsAborted){ result = "(Aborted)"; }else if (request.isError()){ result = "(Error)"; }else if (request.IsFromCache && (request.ResponseStatus != 304)) { result = "(Cache)"; }else if (!request.HasReceivedResponseHeaders && !request.IsFinal){ result = "*"; }else{ result = request.ResponseStatus; } //6.Type: var type = ""; if (request.hasErrorCode()){ if (request.ContentType){ type = request.ContentType + " (" + request.Status.toString(16) + ")";//we omit nsResultErrors translate }else{ type = request.Status.toString(16); } }else if (!request.HasReceivedResponseHeaders && !request.IsFromCache && !request.IsFinal){ type = "*"; }else if (request.isRedirect()){ if (request.ResponseHeaders && request.ResponseHeaders["Location"]){ type = "Redirect to: " + request.ResponseHeaders["Location"]; }else{ type = "Redirect (cached)"; } }else{ type = request.ContentType; } //7.URL var urlstring = request.Url ; //TODO: LOG.info(http sniffer info); //TODO: verify as you like by PatternMatcher } //end for }//end chrome } catch (e) { throw new SeleniumError("Threw an exception: " + e.message); } };
Now, QA can automate HttpFox steps in Selenium. They don't need to do http traffic testing manually all days.
thanks for doing this! :)
ReplyDeleteGreat idea!
ReplyDeleteIs there an howto?
which version of selenium supports httpfox and can u pls briefly explain the process of adding XPCOM objects
ReplyDeleteCan you get a good how to .. about getting Xpi flies merging and all.
ReplyDeletecaptureNetworkTraffic() API in DefaultSelenium captures http request/response headers and you can access them in html/xml/plain format.
ReplyDeleteHere is sample code:
Selenium s = new DefaultSelenium(...);
s.start("captureNetworkTraffic=true");
s.open("http://www.google.com");
String xml = s.captureNetworkTraffic("xml"); // html, plain
s.stop();
Hi Ivan,
DeleteCould you please send me the steps as i am asked to test the cache contaol max header using selenium and also i would need to configure it so if caching time changes, my test should be easily able to manipulate.
Really happy to seen your webpage and look forward to so many more entertaining times reading here. Thanks once more for all the details.
ReplyDeleteData science Course Training in Chennai |Best Data Science Training Institute in Chennai
RPA Course Training in Chennai |Best RPA Training Institute in Chennai
AWS Course Training in Chennai |Best AWS Training Institute in Chennai
Devops Course Training in Chennai |Best Devops Training Institute in Chennai
Selenium Course Training in Chennai |Best Selenium Training Institute in Chennai
Java Course Training in Chennai | Best Java Training Institute in Chennai
very useful article...
ReplyDeletefreeinplanttrainingcourseforECEstudents
internship-in-chennai-for-bsc
inplant-training-for-automobile-engineering-students
freeinplanttrainingfor-ECEstudents-in-chennai
internship-for-cse-students-in-bsnl
application-for-industrial-training
Good, keep sharing
ReplyDeleteinterview-questions/aptitude/permutation-and-combination/how-many-groups-of-6-persons-can-be-formed
tutorials/oracle/oracle-delete
technology/chrome-flags-complete-guide-enhance-browsing-experience/
interview-questions/aptitude/time-and-work/a-alone-can-do-1-4-of-the-work-in-2-days
interview-questions/programming/recursion-and-iteration/integer-a-40-b-35-c-20-d-10-comment-about-the-output-of-the-following-two-statements
Really very happy to say, your post is very interesting to read. I never stop myself to say something about it. You’re doing a great job. Keep it up…
ReplyDeleteGet Best Service Now Training in Bangalore from Real Time Industry Experts with 100% Placement Assistance in MNC Companies. Book your Free Demo with Softgen Infotech.
Thank you for your post. This is excellent information. It is amazing and wonderful to visit your site. Real Time Experts Training in Bangalore center address bangalore
ReplyDeletemmorpg oyunlar
ReplyDeleteINSTAGRAM TAKİPCİ SATIN AL
tiktok jeton hilesi
Tiktok Jeton Hilesi
antalya saç ekimi
İnstagram Takipçi Satın Al
ınstagram takipci satin al
metin2 pvp serverlar
instagram takipçi satın al
FON PERDE MODELLERİ
ReplyDeleteNumara Onay
mobil ödeme bozdurma
NFTNASİLALİNİR.COM
ankara evden eve nakliyat
TRAFİK SİGORTASİ
dedektör
web sitesi kurma
aşk kitapları
ataşehir toshiba klima servisi
ReplyDeletemaltepe alarko carrier klima servisi
kadıköy alarko carrier klima servisi
maltepe daikin klima servisi
kadıköy daikin klima servisi
kartal toshiba klima servisi
ümraniye toshiba klima servisi
kartal beko klima servisi
ümraniye beko klima servisi
lovely information perform article. This announce is as a matter of fact the top notch cruelly this imperative circumstance. Office Product Key Free
ReplyDeleteThe way that we are not any more together won't ever remove the way that you will constantly be exceptional to my heart. Birthday Paragraph For Boyfriend
ReplyDelete