Cannot Locate WebView2 Elements in Word Add-ins Desktop Application

Hello,

I am working on automating Word Add-ins testing using Katalon Studio. My test case scenario involves two key components:

  1. Automating Ribbon Buttons: These are standard Windows elements, which I am able to automate successfully using Katalon’s Windows automation features.
  2. Automating WebView2 Elements in the Task Pane: The task pane of the add-in contains a WebView2 browser with web elements that I need to interact with.

Challenges:

  1. Element Capture Delay: Capturing WebView2 elements using the Spy Web or Recorder takes a significant amount of time.
  2. Element Identification Issues:
    * Some WebView2 elements lack the Name property and instead rely on the Title
    property.
    * These elements do not get captured correctly or dynamically identified, even when
    using locators like XPath with @title (e.g. //*[contains(@title, ‘value’)]).
  3. Interaction Failures: Methods like WebUI.click() or WebUI.verifyElementPresent() fail to interact with the WebView2 elements, despite dynamic locators.

Questions:

  1. How can I reliably locate and interact with WebView2 elements using the Title property?
  2. Are there specific settings or capabilities I need to enable in Katalon Studio for better WebView2 support?
  3. Is there a way to switch context between Windows automation and WebView2 elements?

Any guidance for handling this combination of Windows and WebView2 elements would be highly appreciated.
Thank you.

1 Like

Hi there, and thanks for posting in the Katalon community! :hugs:

To help you faster, please review our guide on Spy Web Utitliy here: Spy Web utility in Katalon Studio | Katalon Docs. Double-checking the steps and configurations might resolve the issue.

If the doc doesn’t help, feel free to provide more details, and a community member will assist you soon.

Thanks for being a part of our community!
Best,
Vu Le