XHR Wait Integration

Overview:

The Selenium JS plugin in Opkey has been improved to enhance the page load waiting mechanism by introducing XHR (XMLHttpRequest) wait. Previously, the Selenium JS waiting mechanism relied on the page loading state and Angular waits. With the addition of XHR wait, the plugin now waits for Angular calls, JS, jQuery, Ajax, and XHR to address object-loading challenges. Users can modify the XHR wait value at the Opkey Agent end.

XHR waits function when a web page has pending requests such as Ajax, HTTP, or JQuery via XHR call or native mechanism. By default, XHR Wait waits for 30 seconds to clear all pending requests (XHR/Ajax).

Working Mechanism of XHR Wait:

  • If there are no pending requests on the page, Selenium JS operates normally, allowing keywords to complete their actions within the defined timeout (Opkey timeout).
  • If there are pending XHR requests on the page, the XHR wait activates and waits according to the following scenarios to ensure all pending requests are cleared.

(A) If pending requests are cleared before the XHR wait (default 30 sec or user-defined), the XHR wait stops immediately, and the keyword executes to perform its operation within the remaining Opkey timeout.

Example: OpKey Timeout: 50 sec, XHR Wait: 30 sec (Default) Pending requests clearance time: 10-sec Remaining timeout for the keyword operation: 50-10 = 40 sec

(B) If pending requests are not cleared within the XHR wait (default 30 sec or user-defined), the XHR times out, and the keyword executes to perform its operation within the remaining Opkey timeout.

Example: OpKey Timeout: 50 sec, XHR Wait: 30 sec (Default) Remaining timeout for the keyword operation: 50-30 = 20 sec

(C) If the XHR wait is provided (default or user-defined) and the Opkey timeout is the same or less, the XHR wait automatically adjusts to Opkey timeout minus 5 sec.

Examples:

  • If XHR wait and Opkey timeout are the same: Opkey Timeout: 30 sec, XHR Wait: 30 sec (Default) Remaining timeout for keyword operation: 30-5 = 25 sec

  • If XHR wait is greater than Opkey timeout (or vice versa): Opkey Timeout: 20 sec, XHR Wait: 30 sec (Default) Remaining timeout for keyword operation: 20-5 = 15 sec

Note: XHR wait halts immediately when pending requests are cleared, allowing the keyword to execute within the remaining Opkey timeout.



Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article