Forum Discussion

DanNad's avatar
DanNad
Contributor
7 months ago

WebView2 support does not work

Hello everyone. Did someone manage to get this to work?

There is no documentation on webview2 and also smartbear support doesnt seem to know how we can get this to work. We tried a lot of different approaches already but the object spy does not recognize the objects within the webview2 window.

Support gave us the string "--edge-webview-switches=--remote-debugging-port=92223" and we are supposed to add it to the command line field in TestedApps but this doesnt seem to make sense because i dont know how our proprietary software is supposed to know this command line parameter. I tried it anyways but our software is giving us an error message on startup stating the switch is invalid.

I managed to get this to work with our selenium project where we also use the remote debugging port to enable the webdriver to attach to the webview2 process. But i cant figure a way out how this should work with testcomplete.

14 Replies

  • Its the second Testcomplete version (15.70) that states either Web View 2 is supported or there were improvements made to Web View 2 support. Still there is zero article in the Testcomplete documentation pages that tells the user how to get this to work.

    Can someone on here tell how to get this to work?

    • Michael_B's avatar
      Michael_B
      Occasional Contributor

      No luck with v15.71. Maybe I'm missing a setting. Is there somewhere I need to add the support specifically? I see that it has been supported since v15.69 but don't see anything about it specifically in on the support site.

      • DanNad's avatar
        DanNad
        Contributor

        Same for us. 15.71 and its still not working. This is very very disappointing

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

    I've been looking into this, and learning about WebView2. I have a simple C# WebView2 forms application that displays a web site.

    C# WebView2 form application

    The Object Browser shows the following

    Standard UI controls exposed

    Enabling MSAA (TC -> Project Settings), exposes the controls of the application

    Application controls exposed

    Enabling UI Automation (TC -> Project Settings), exposes even more of the application

    More controls exposed of the application

    and also WebView2, including the UI controls within

    WebView2 and all UI controls with

    For this to work correctly, the appropriate flag settings needs to be enabled for WebView2 control within the application.

    Using TC version

    If you're using Selenium WebDriver, then you can use the following command (I haven't tested this)

    var environment = await CoreWebView2Environment.CreateAsync(null, null, new CoreWebView2EnvironmentOptions("--remote-debugging-port=9222"));
    await webView.EnsureCoreWebView2Async(environment);
    

    I hope this helps, and gives you a starting point.

    • DanNad's avatar
      DanNad
      Contributor

      I expect Testcomplete to let me map the objects that are displayed inside of the webview2 windows like other cross browser enabled mappings (e.g. using xpath, css selectors and so on)

      This does not work. Enabling UI Automation (TC -> Project Settings) doesnt let me do that and this also worked in earlier versions of testcomplete where there was no webview2 support.

      Currently our only option is to make a selenium project which uses the remote debugging port and integrate it into the testcomplete testscripts.