Select AJAX(Click & script) protocol if your application contain Ajax functionality.
AJAX (Asynchronous java and XML) is preferred solution for creating fluid application with advance user interactivity. Traditionally browser use GET and PUT method to refresh entire page for every interaction with the server, this would create load on server and network. By using AJAX, browser and server exchange small amounts of data in (XML or JASON format) asynchronously in the background through XMLHttpRequest object with out reloading the whole page for every user action. Javascript code use the data received from the server and update HTML in browser DOM (Document object model) which contain all the elements of the browser session.
By using very limited object properties, HP could implement QTP technology into this protocol.
Loadrunner will create corresponding Web_xxxxx function, when user perform actions on STANDARD web objects. It can't recognize third party objects, then we need to use Java script to emulate user actions.
Understand third party object methods, properties by looking at the page source code or interacting with the developer who created the page and create corresponding javascript code.
Attaching sample code for FCK editor and ULTRA web grid.
web_browser("Java_Script",
ACTION,
"EvalJavaScript= var oEditor = FCKeditorAPI.GetInstance('ctl00_cpheSupplier_txtNdaMessage');var oDOM = oEditor.EditorDocument;oDOM.body.innerText = 'Bharath';",
LAST);
web_browser("Java_Script",
ACTION,
"EvalJavaScript=igtbl_getRowById('ctl00xcpheRFxxUltraWebGrid1_r_16').getCell(7).setValue('999');updating = true;"
"EvalJavaScript=igtbl_getRowById('ctl00xcpheRFxxUltraWebGrid1_r_17').activate();",
LAST);
Some time we may require to retrieve page DOM values. Attaching sample code that retrieve element properties into loadrunner.
web_browser("JavaScriptCode",
DESCRIPTION,
ACTION,
"EvalJavaScript=var id = document.getElementById('message');EvalJavaScriptResultParam = id.style.display;",
"EvalJavaScriptResultParam=prmJavaScriptReturn",
LAST);
lr_output_message("%s",lr_eval_string("{prmJavaScriptReturn}"));
----
No comments:
Post a Comment