Permission denied to access property "shadowRoot"

Hi,

When I try setting Test Object like

and running a test using verifyElementPresent in firefox .

However return error like below.

How can I handle shadow dom in firefox ?

Could you please show me this.

Thanks .


at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64)

at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:26)

at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain$runKeyword.call(Unknown Source)

at com.kms.katalon.core.webui.keyword.builtin.WaitForElementVisibleKeyword.waitForElementVisible(WaitForElementVisibleKeyword.groovy:98)

at com.kms.katalon.core.webui.keyword.builtin.WaitForElementVisibleKeyword.execute(WaitForElementVisibleKeyword.groovy:68)

at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:72)

at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.waitForElementVisible(WebUiBuiltInKeywords.groovy:434)

at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$waitForElementVisible$11.call(Unknown Source)

at editor.click_pluss.clickPluss(click_pluss.groovy:33)

at editor.click_pluss.invokeMethod(click_pluss.groovy)

at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:50)

at create_guide.run(create_guide:22)

at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)

at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)

at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:337)

at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)

at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)

at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)

at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)

at com.kms.katalon.core.main.TestSuiteExecutor.accessTestCaseMainPhase(TestSuiteExecutor.java:169)

at com.kms.katalon.core.main.TestSuiteExecutor.accessTestSuiteMainPhase(TestSuiteExecutor.java:142)

at com.kms.katalon.core.main.TestSuiteExecutor.execute(TestSuiteExecutor.java:91)

at com.kms.katalon.core.main.TestCaseMain.startTestSuite(TestCaseMain.java:157)

at com.kms.katalon.core.main.TestCaseMain$startTestSuite$0.call(Unknown Source)

at TempTestSuite1587712223364.run(TempTestSuite1587712223364.groovy:36)

Caused by: org.openqa.selenium.JavascriptException: Error: Permission denied to access property "shadowRoot"

Hello @sura

Working with Shadow DOM Objects in Katalon Studio has the following known limitations:

  • Only for Chrome browser (53 to latest version). Other browsers will be considered for future releases.
  • Only allow 1 level of nested Shadow DOM parent
  • Record and Spy feature will not work with Shadow DOM (since elements do not exist in the DOM).

Jass

Hi @Jass

Thank you for answering.

Hi @Jass ,

May I ask you again ?

I want to handle shadow dom using css selector .
Specifically, I want to use nth-child .

Could you please give me some advices ?

Thanks .

@sura You might want to check out:
https://store.katalon.com/product/128/Multi-Level-Shadow-DOM-Automation-Plugin
In there Git Hub Repo are some samples also to get you on your way.

Looks like you have errors in both Element references and this Scope (in You injected the template into a Component document can not access elements inside any Component shadowDOM doesn't matter if the shadowDOM is mode:closed or mode:open

The #inside{ color:green; } one major issue: will only execute for the first used element!!

I didn’t write this of the top of my head,
(Work in progess) JSFiddle playground (also showing referencing Component methods) at:
https://jsfiddle.net/CustomElementsExamples/zpamx728/

Update #1
Chromium (Edge/Chrome) and Opera are fine, FireFox v72.0.2 misbehaves:

the onload on a element will only fire for the first element
I changed the JSFiddle to use your first hack using an , and it fires for every element

templFunc() is loaded/scoped in shadowDOM, so is callable from component methods (see JSFiddle)
but… only in FireFox is NOT defined/available for the first element
For now I consider this a FireFox bug… will investigate further… (to boldly go where…)

!!! Update #2 !!!
OOPS! Played some more with it.

Turns out all variables and functions from a cloned and imported SCRIPT
are hoisted to the global window scope

So above code works, but has a major side-effect…

That is also why FireFox complains about re- declaring let variables
Admin

MODERATED TO REMOVE DISALLOWED ADVERTISING

Thanks for replying .