| Autodoc - Functions |
<a href=... ></a>) containing the given text.
This function is a shortcut for WebReplay_FindHTMLControl("a", "href", strURL).
function WebReplay_FindAnchorWithHref(strURL)
strURL
(type String)
: Searched URL (value of attribute href)Return value: objHTMLControl: HTML Control found (or null is control has not been found)
var objHTMLControl = WebReplay_FindAnchorWithHref("mypage.asp");<a ... ></a>) containing the given text.
This function is a shortcut for WebReplay_FindHTMLControl("a", "innerText", ...).
function WebReplay_FindAnchorWithText(strText)
strText
(type String)
: Searched text (value of attribute innerText)Return value: objHTMLControl: HTML Control found (or null is control has not been found)
var objHTMLControl = WebReplay_FindAnchorWithText("click here");<input type=button ... >) containing the given text.
This function is a shortcut for WebReplay_FindHTMLControl("input", "value", strText).
function WebReplay_FindButtonWithText(strText)
strText
(type String)
: Searched text (value of attribute innerText)Return value: objHTMLControl: HTML Control found (or null is control has not been found)
var objHTMLControl = WebReplay_FindButtonWithText("OK");function WebReplay_FindHTMLControl(strTagName, strAttributeName, strAttributeValue)
Return value: objHTMLControl: HTML Control found (or null is control has not been found)
var objHTMLControl = WebReplay_FindHTMLControl("a", "innerText", "click here");function WebReplay_FindHTMLControlFromText(strTagName, strText)
Return value: objHTMLControl: HTML Control found (or null is control has not been found)
var objHTMLControl = WebReplay_FindHTMLControlFromText("a", "click here");function WebReplay_FindHTMLControlWithName(strHTMLControl)
strHTMLControl
(type String)
: Name of the HTML control (or id)Return value: objHTMLControl: HTML Control found (or null is control has not been found)
var objHTMLControl = WebReplay_FindHTMLControlWithName("Text1");function WebReplay_FindTags(strTagName)
strTagName
(type String)
: Searched tagReturn value: arrHTMLTags: collection of HTML Controls found
// Get all hyperlinks in page
var arrHTMLTags = WebReplay_FindTags("a");
// Loop on found links
if (arrHTMLTags != null)
{
for (var intTag = 0; intTag < arrHTMLTags.length; intTag++)
{
var objHTMLControl = arrHTMLTags[intTag];
// Do something with this objHTMLControl...
}
}
function WebReplay_GetHTMLControl(strHTMLControlId, objHTMLDocument)
Return value: objHTMLControl: HTML Control found (or null is control has not been found)
var objHTMLControl = WebReplay_GetHTMLControl("Text1");true if an HTML control is ready, i.e.:
function WebReplay_IsControlReady(objHTMLControl)
objHTMLControl
(type object)
: HTML Control objectReturn value: blnReady: true if HTML Control is ready, false otherwise
var blnDone = false;
var objHTMLControl = WebReplay_FindHTMLControlWithName(strHTMLControl);
if (WebReplay_IsControlReady(objHTMLControl))
{
blnDone = WebReplay_SimulateInput(objHTMLControl, strHTMLValue, true, intNewState);
}
function WebReplay_Log(strHTMLMessage)
strHTMLMessage
(type String)
: Message text (HTML format allowed)Return value: none
WebReplay_Log("been here");function WebReplay_Navigate(strURL, intNewState)
strURL
(type String)
: Uniform Resource Location (URL) to navigate toReturn value: blnDone: boolean; true if navigation is successful, false otherwise
var blnDone = WebReplay_Navigate("http://localhost");function WebReplay_SetStateNext(intNewState, blnLog, blnDisplay)
intNewState
(type Integer)
: State to switch to (optional - if null, the scenario automatically switches to next state)blnLog
(type Boolean)
: Boolean flag - true means that the state change is logged in Web Replay's top frame (true by default)blnDisplay
(type Boolean)
: Boolean flag - true means that the state change is displayed in Web Replay's top frame (true by default)Return value: none
WebReplay_SetStateNext();
<input type=checkbox ... >).
function WebReplay_SimulateCheckboxInput(strHTMLControl, blnChecked, intNewState)
strHTMLControl
(type String)
: Name of the HTML control (or id)blnChecked
(type Boolean)
: Boolean flag: true means that the box will be checked, false means that the box will be uncheckedintNewState
(type Integer)
: State to switch to once the user interaction is done (null by default: switch to next state)Return value: blnDone: boolean; true means that the box has successfully been checked or unchecked
WebReplay_SimulateCheckboxInput("Check1");function WebReplay_SimulateHTMLElementClick(strHTMLControl, intNewState, blnRaiseEvents)
strHTMLControl
(type String)
: Name of the HTML control (or id)intNewState
(type Integer)
: State to switch to once the user interaction is done (null by default: switch to next state)blnRaiseEvents
(type Boolean)
: Boolean flag: true means that standard events will be raised (true by default): onmousedown, onfocus, onmouseup, onblurReturn value: blnDone: boolean; true means that the control has successfully been clicked
WebReplay_SimulateHTMLElementClick("OK");<input type=text ... >)
function WebReplay_SimulateTextInput(strHTMLControl, strHTMLValue, intNewState)
Return value: blnDone: boolean; true means that the text input has successfully been done
WebReplay_SimulateTextInput("Text1", "NewValue1");function WebReplay_URLEncode(strRaw)
strRaw
(type String)
: Raw string valueReturn value: strURLEncoded: URL-encoded string value
var strURLEncoded = WebReplay_URLEncode("http://www.google.com");function WebReplay_WaitForHTMLControl(strTagName, strAttributeName, strAttributeValue, intNewState)
Return value: blnDone: boolean; true means that the control has successfully been found
WebReplay_WaitForHTMLControl("h2", "innerText", "Form Submit Debugger", -1);function WebReplay_WaitForHTMLControlWithName(strHTMLControlId, intNewState)
strHTMLControlId
(type String)
: Name of the HTML control (or id)intNewState
(type Integer)
: State to switch to once the HTML control is available (null by default: switch to next state)Return value: blnDone: boolean; true means that the control has successfully been found
WebReplay_WaitForHTMLControl("OK");function WebReplay_WaitForWindowStatus(strExpectedStatus, intNewState)
strHTMLControlId
(type String)
: Name of the HTML control (or id)intNewState
(type Integer)
: State to switch to once the window status is found (null by default: switch to next state)Return value: blnDone: boolean; true means that the control has successfully been found
WebReplay_WaitForWindowStatus("Done");function WebReplayScenarioAuto(arrStates)
arrStates
(type Array)
: Array of states composing the scenario to replayReturn value: none
function WebReplayScenario()
{
WebReplayScenarioAuto(
[
// State 1: Navigate to the test Page (uses an anonymous function definition)
[ null, function () { WebReplay_Navigate("http://localhost/WebReplay2/WebReplay2Scenario1_step1.asp") } ],
// State 2: Type in some text in a form field named Text1
[ "Text1", "NewValue1" ],
// State 3: Submit form by clicking on a submit button named "OK"
[ "OK" ],
// State 4: Type in some text in a form field named Text21
[ "Text1", "NewValue2" ],
// State 5: Submit form by clicking on a submit button named "OK"
[ "OK" ],
// State 6: Wait for next page's title: <h2>Form Submit Debugger</h2>
// Set state to -1 (end) when the control is found.
[ null, function () { WebReplay_WaitForHTMLControl("h2", "innerText", "Form Submit Debugger", -1) } ]
]
);
}