Adding "shadow-root" support to Kantu


I do understand that Kantu currently does not support website that are using “shadow-root” in the HTML code.
And I do know that xClick is one of the work arounds but makes automations more sensitive (as web zoom needs to be set to 100% and the page must be always visible)

I really would like to keep writing kantu automatons that are less sensitive to to the browser environment. But I do see more and more websites popping up now using “shadow-root” which makes my job more very difficult.

Is this a possible solution?:
I do keep reading about “javascriptexecutor” that can get around this issue in selenium by importing a javascript file with that functionality. I think Kantu is based on this selenium:

How to use JavaScriptExecutor in Selenium
Here is a step-by-step process on how to use JavaScriptExecutor in Selenium:

Step 1) Import the package.
import org.openqa.selenium.JavascriptExecutor;

Step 2) Create a Reference.
JavascriptExecutor js = (JavascriptExecutor) driver;

Step 3) Call the JavascriptExecutor method.
js.executeScript(script, args);

To Click a then a button:
js.executeScript(“document.getElementById(‘enter element id’).click();”);

My question is

  1. Is it possible to add this functionality into Kantu engine?
  2. Is there even any consideration to get this issue fixed in the future?

Thank you

Thanks for asking! We might implement it at a later time.

Currently our focus is on further improving the computer-vision commands, which, as know, supports Shadow-DOM automation by design. For example, we just released XClickText and will soon have XClickTextRelative.

From our point of view, visual automation is the future of web and test automation.

I do know that xClick is one of the work arounds but makes automations more sensitive (as web zoom needs to be set to 100% and the page must be always visible)

Actually, I would argue against this. I have seen several XPath-level automation projects that failed to work after a few months, because a website update changed some IDs under the hood. Whereas the image-based automation continues to work fine.

web zoom needs to be set to 100%

  • This is currently still true for XClick, but we are working on improving this.

  • Good news: This is not true for the new XClickText and (soon) XClickTextRelative commands. They rely on text recognition (OCR) and are agnostic to changes in the resolution.

the page must be always visible

That is correct. We (and many test automation users that we know) run their tests inside a virtual machine for this reason.

PS: Having said all this, if we find an easy way to implement Shadow-DOM support on the Selenium/HTML level, too, we will do it.

Thanks a lot for taking the time explaining everything.
I’m looking forward to keep using your product and hope to see more future Selenium/HTML level enhancements with Shadow-DOM support.

Hendrik Kupfernagel

Hi I think I found a way to access the shadow-root with kantu:

Example Shadow-root page: Shadow DOM
Kantu script:

“Command”: “executeScript”,
“Target”: “//\n//

\n\n//Works!!!\nvar test = document.querySelector(‘#shadow_host’).shadowRoot.querySelector(‘#shadow_content’).querySelector(‘.info’).innerHTML;\n//-> “some text”\nvar test = document.querySelector(‘#shadow_host’).shadowRoot.querySelector(‘#shadow_content’).innerHTML;\n//-> “<span class="info">some text”\nreturn test;”,
“Value”: “myvar”,
“Description”: “shadow dom test page”