Issue with setElementWaitTimeout failing to pause execution during DOM transitions (Browser Item)

XMLWordPrintable

    • Type: Incident report
    • Resolution: Unresolved
    • Priority: Minor
    • None
    • Affects Version/s: None
    • Component/s: Server (S)
    • None

      Hello Zabbix Team,

      We are writing to report an issue regarding the behavior of the setElementWaitTimeout() method within the Zabbix Browser item.

      Currently, we have structured our synthetic monitoring scripts using a centralized, object-oriented approach (as seen in the attached template). This architecture relies on dynamically waiting for elements to appear on the screen before interacting with them. However, we have observed that setElementWaitTimeout does not reliably pause execution while waiting for elements to become interactable, particularly during Single Page Application (SPA) state changes.

      Expected vs. Actual Behavior:

      The expected behavior of setElementWaitTimeout(timeout) is to act as an explicit wait—pausing the script execution up to the maximum timeout value until the targeted element is rendered and ready. If the element appears in 2 seconds, the script should proceed immediately.

      Instead, during dynamic transitions where the DOM updates without a full page reload, the method fails to wait. It returns immediately and crashes the script when attempting to interact with elements that are still transitioning or hidden.

      Impact on Performance Metrics:

      To bypass this limitation, we are forced to inject fixed Zabbix.sleep() intervals between user actions to give the page enough time to render. This is highly problematic because fixed sleeps introduce artificial delays into our data. It inaccurately inflates the overall page load times and performance metrics, compromising the reliability of the synthetic monitoring data we deliver to our stakeholders.

      Steps to Reproduce (Using Microsoft SSO):

      This behavior is consistently reproducible in web applications utilizing Microsoft Integrated Authentication, which uses a split-screen login flow.

      1. The script accesses the login page and configures browser.setElementWaitTimeout(10000).
      1. The script inputs the username on the first screen and clicks "Next".
      1. The Microsoft portal performs an asynchronous DOM transition to display the password field (no page reload).
      1. The script attempts to find the password field.
      1. Result: The script crashes immediately with a "cannot find element" error, proving that setElementWaitTimeout did not hold the execution for the allowed 10 seconds.

      Script Reference: In the attached YAML template, specifically around line 93 of the JS script, we had to add a hardcoded Zabbix.sleep(1000) before looking for the password field. If this sleep is removed, the script fails, demonstrating that the global element wait timeout is not being respected during the transition.

      Attachments:

      • template_browser_monitoring.yaml (Template containing our script architecture and the required sleep workarounds).

      We kindly request the development team to investigate the underlying behavior of setElementWaitTimeout in SPA scenarios so we can rely on accurate, sleep-free performance metrics.

      Best regards,

            Assignee:
            Zabbix Support Team
            Reporter:
            Lucas Frade
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: