Skip to main content

HTTP Level API functions

_get = get

Parameters: url
Description: Executes a GET HTTP call, and returns the HTTP response.
Example:

_prepareDomain("https://www.wikipedia.org");
var response = _get("/");
assertEqual(response.status,200);
assertEqual(response.headers.contentType.first,"text/html");
log("response.getDataString()"+response.getDataString());
assertContains(response.getDataString(),"wikipedia");

_createGet = createGet

Parameters: url
Description: creates an HTTP GET request object. The object can be used to add headers, and to execute it just need to execute an eval.
Example:

_setDomain("http://localhost:9090");
var myGet = _createGet("http://localhost:9090/ds/dyn/basic/echo");
myGet.addUpdateQueryAction("echo","?echo=4&data=7",false);
assertEqual("?echo=4&data=7", myGet.eval().toStringContent());

_createPost = createPost

Parameters: url
Description: creates an HTTP POST request object. The object can be used to add headers, and to execute it just need to execute an eval.
Example:

var myPost = createPost("https://appvancetest.service-now.com:443/api/now/ui/page_timing/7d9bd42f13e71b00ae43721a6144b0b5");
myPost.addHeader("Content-Type", "application/json");
myPost.addHeader("X-Requested-With", "XMLHttpRequest");
myPost.setContentType("application/json");
var resp = myPost.eval().getContentString();

_createPatch = createPatch

Parameters: url

Description: creates an HTTP POST request object. The object can be used to add headers, and to execute it just need to execute an eval.
Example:

var call = createPost("https://appvancetest.service-now.com:443/api/now/ui/page_timing/7d9bd42f13e71b00ae43721a6144b0b5");
call.addHeader("Content-Type", "application/json");
call.addHeader("X-Requested-With", "XMLHttpRequest");
call.setContentType("application/json");
var call = call.eval().getContentString();


_createPut = createPut

Parameters: url
Description: creates an HTTP PUT request object. The object can be used to add headers, and to execute it just need to execute an eval.
Example:

_setDomain("http://localhost:9090");
var call = _createPut("http://localhost:9090/ds/dyn/basic/echo?echo=4&data=7");
log(call.eval().toStringContent());

_createHead = createHead

Parameters: url
Description: creates an HTTP PUT request object. The object can be used to add headers, and to execute it just need to execute an eval.
Example:

_setDomain("http://localhost:9090");
var call = _createHead("http://localhost:9090/ds/dyn/basic/echo?echo=4&data=7");
log(call.eval().toStringContent());


_createOptions = createOptions

Parameters: url
Description: creates an HTTP PUT request object. The object can be used to add headers, and to execute it just need to execute an eval.
Example:

_setDomain("http://localhost:9090");
var call = _createHead("http://localhost:9090/ds/dyn/basic/echo?echo=4&data=7");
log(call.eval().toStringContent());


Functions used by AI processes

_pageStructure= pageStructure(validDomains, type)

Parameters:

  • validDomains a list of valid domains with its protocol for main windows we want to get the structure. It accepts JSONArray, ArrayList and String[]

  • type: The type of elements the pageStructure wil provide. Currently, Smarttags, Inputs, Tags, SmarttagsInputs and SmarttagsTags are the valid values to pass.

Description: gets the current page Structure based on DS3 Page Structure.

Example:

addSmartTagsLibrary("demosite.stags");
var pageStructure = pageStructure("https://demosite.appvance.com","Smarttags");

_setCompatibility = setCompatibility

Parameters: boolean
Description: Enables the compatibility mode for sites that run in legacy Internet Explorer versions.

Internet Explorer is no longer supported browser in AIQ.
Example:

_setCompatibility(true);
_navigateTo("http://sahitest.com/");
_click(_link("demo"));

_getCompatibility = getCompatibility

Description:
Example:

_setCompatibility(true);
assertTrue(_getCompatibility());
_navigateTo("https://ApplicationURL");
_setValue(_textbox("user"), $UserName);
_setValue(_password("password"), $Password);
_click(_submit("Login"));
_click(_cell($PatientNumber));

if (var1 == "No data entered \nClick to view CRF") {
_click(_link("Logout"));
} else {
_click(_button(19));
_click(_link("Logout"));
}
_setCompatibility(false);
_assertFalse(_getCompatibility());




Last updated: June 05, 2024

If you have any feedback on this topic, please contact us at documentation@appvance.ai