1. Home
  2. Opkey Help
  3. 26. Advanced Opkey Usage
  4. 26.16 XHR Wait Integration

26.16 XHR Wait Integration

Overview:

The waiting mechanism of Selenium JS plugin for the page load at run time has been enhanced by introducing the XHR (XMLHttpRequest) wait. Earlier Selenium JS waiting mechanism works on the basis of Page Loading state and angular waits. Now the XHR (XMLHttpRequest) wait has been implemented with Selenium JS Plugin to wait for angular calls, JS, Jquery, Ajax and XHR to mitigate the challenge of object loading issue. XHR wait option has been provided for users at the OpKey Agent end to modify/Edit its value.

XHR simply works when your web page is having pending request(s) like Ajax, HTTP, JQuery via xhr call or using native mechanism. By default, XHR Wait waits for 30 seconds for clearing all the pending requests (XHR/Ajax).

XHR Wait Working Mechanism:

  • If there are no pending requests on the page, Selenium JS will behave normally i.e. keywords will get complete time to perform its action with in the defined timeout (Opkey timeout)
  • If there are pending xhr requests on the page, XHR wait will come in to action and wait as per the below mentioned cases so that all the pending requests get clear.

(A) In case the pending requests get clear before the XHR wait (30 sec by default or as provided by user), XHR wait halts immediately and keyword starts executing to perform its desired operation within the remaining OpKey time out.

For Example:

Opkey Timeout: 50 sec, XHR Wait: 30 sec (By default)

Pending requests clearance time: 10 sec

Remaining time out for keyword to perform desired operation: 50-10 = 40 sec.

(B) In case the pending requests are not cleared with in the XHR wait (30 sec by default or as provided by user), XHR gets time out and keyword starts executing to perform its desired operation within the remaining OpKey time out.

For Example:

Opkey Timeout: 50 sec, XHR Wait: 30 sec (By default)

Remaining time out for keyword to perform desired operation:  50-30 = 20 sec.

(C) In case the XHR wait provided (as provided by user or by default timeout) and the OpKey time out are same or less then XHR wait will automatically wait for OpKey time out minus 5 sec

For Example:

In case XHR wait and Opkey Time out are same:

Opkey Timeout: 30 sec, XHR Wait: 30 sec (By default)

Remaining time out for keyword to perform desired operation:  30-5 = 25 sec.

In case XHR wait is greater than Opkey Time out (or vice versa):

Opkey Timeout: 20 sec, XHR Wait: 30 sec (By default)

Remaining time out for keyword to perform desired operation:  20-5 = 15 sec.

 

Note: As soon as the pending requests get clear, XHR halts immediately and keyword starts executing to perform its desired operation within the remaining OpKey time out.

Was this article helpful to you? Yes No