Praman — Agent-First SAP UI5 Test Automation Plugin - v1.3.5
    Preparing search index...

    Class NativeDialogHandler

    Observes and optionally answers native browser dialogs.

    const handler = new NativeDialogHandler({ page });
    handler.observe();
    Index
    • Removes every listener this handler attached.

      Returns void

      Removing the dialog listener hands dialogs back to Playwright, which resumes auto-dismissing them. Safe to call when nothing was registered.

      handler.dispose();
      
    • Starts recording dialogs without changing behaviour.

      Returns void

      Attaches only dialogclosed, never dialog, so Playwright keeps auto-dismissing exactly as it would without Praman. Safe to call unconditionally; calling it twice is a no-op.

      Degrades to no diagnostics below Playwright MIN_DIALOG_CLOSED_VERSION and logs that it did. It does not throw: there is no floor equivalent for watching a dialog without taking responsibility for it, and observation is additive, so silence is the honest degrade rather than denying the caller a working test.

      handler.observe();
      
    • Opts into answering dialogs according to a rule.

      Parameters

      Returns void

      The first call attaches the single dialog listener. From that moment Playwright stops auto-dismissing, so this class answers every dialog: a type no rule covers, or a rule that has hit its times cap, is dismissed and logged at warn rather than left to freeze the page.

      PramanError with ERR_CONFIG_INVALID for an empty types list or a duplicate rule name.

      handler.register({ name: 'discard', types: ['beforeunload'], action: 'accept' });