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.
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.