Skip to content

Dioxus embedded driver: blank screenshots; no alerts, print, frames or shadow roots #721

Open

Description

@goosewobbler

Problem

The Dioxus embedded driver runs every command as JavaScript in the page and has no native handle to the webview. Compared with Tauri's embedded driver (tauri-plugin-webdriver), it's missing:

Command Dioxus embedded Tauri embedded
Screenshots, page and element Silently return a blank 1×1 PNG Native capture on all three OSes
Alerts (accept, dismiss, text) "unsupported operation" Intercepts the native dialogs
Print "unsupported operation" Native PDF on all three OSes
Frames "unsupported operation" Page JavaScript
Shadow roots No route Supported
Cookies Only cookies the page can read through document.cookie, so no HttpOnly cookies; path and domain are always reported as / and empty Supported

Running through the page also means anything that stops the page's JavaScript stalls the driver. That includes a native alert(), a long-running script, and a hidden window whose timers get throttled.

The silent blank screenshot is the worst of these: saveScreenshot(), screenshots taken on test failure and visual comparison all get an empty image without any error. The docs claimed screenshots work on every platform until #703. e2e/test/dioxus/visual.spec.ts doesn't catch it: it calls saveScreen, which saves a baseline without comparing anything, so it passes on a blank image.

Fix

  • Screenshots, print and alerts: these need the native webview handle, the same prerequisite as Dioxus: embedded driver keys arrive isTrusted:false on Windows/WebView2 #720. With it, port Tauri's code:
    • WebView2: CapturePreview, PrintToPdf, ScriptDialogOpening.
    • WKWebView: takeSnapshot, createPDF.
    • WebKitGTK: snapshot.
  • Frames and shadow roots: Tauri does frames in page JavaScript, so both may port without the handle.
  • In the meantime: a screenshot should return an error, not a blank image. Make the visual spec compare against a committed baseline (checkScreen), so it fails on a blank image.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    scope:dioxusDioxus service, bridge, and driverstype:bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions