Forum Discussion

ImNotARealQA's avatar
ImNotARealQA
Occasional Visitor
19 days ago

Trouble Recording Tests for WPF WebView2 Application – Entire Window Detected Instead of UI Elements

Hi everyone,

I'm currently evaluating TestComplete to see if it's a good fit for testing my WPF application, which uses a WebView2 container to render our web-based UI.

During my trial, I’ve run into a major roadblock: when I try to record tests or use the Object Spy, TestComplete only detects the entire application window as a single object. It doesn’t recognize or allow interaction with individual UI elements inside the WebView2 control.

I’ve tried both keyword test recording and using the Object Spy, but neither approach identifies the DOM elements or controls within the WebView2 content. Instead, TestComplete treats the entire WebView2 area as a single object.

Additionally, I wasn’t able to find any documentation or official guidance regarding TestComplete’s support for desktop applications using WebView2. This makes it difficult to determine whether this is a limitation of the tool or if there’s a configuration I’m missing.  The previous posts regarding this issue are in the realm of 6-8 years old so I'm hoping there is a current fix to this issue.

Has anyone successfully tested a WPF + WebView2 application with TestComplete? Are there any configurations, plugins, or workarounds that allow TestComplete to access and interact with the DOM inside WebView2?

2 Replies

  • Hassan_Ballan's avatar
    Hassan_Ballan
    Icon for Champion Level 3 rankChampion Level 3

    Official TestComplete documentation mentions support for WebView2 in the following release notes:

    However, there’s currently no detailed documentation on how to enable or fully utilize WebView2 support—especially when it’s hosted inside a WPF application.

    🔧 Recommendation:

    Since you're still in a trial phase, I strongly recommend opening a support ticket with SmartBear and asking:

    • Is full WebView2 (WPF-hosted) DOM support currently available in TestComplete?
    • Are there required configurations, settings, or limitations?
    • Is there a roadmap for improved or full support in upcoming releases?

    🔗 SmartBear Support Portal

    Be sure to clearly describe your setup (WPF app embedding WebView2) and mention your TestComplete version (e.g., 15.69+).

    ✅ Things to Attempt:

    1. Enable UI Automation and MSAA:
      Go to:
      Tools > Current Project Properties > Open Applications > UI Automation / MSAA
      This may help expose more of the accessibility tree for the embedded content.
    2. Enable WebView2 Remote Debugging (if possible):
      If your dev team can launch WebView2 with the flag:
      --remote-debugging-port=9222
      …then external tools (and possibly TestComplete via scripting) might connect to and inspect the internal DOM.
    3. Ensure the Web Testing module is active
      Double-check that the “Web Testing” plugin/module is enabled in your TestComplete installation.
    4. Test against a minimal WebView2 sample app
      This helps isolate whether the issue is with TestComplete’s capabilities or something app-specific (e.g. custom rendering or composition layers).

    🤖 AI-assisted response
    👍 Found it helpful? Click Like
    ✅ Issue resolved? Click Mark as Solution