# Obtaining value from shadow root

**URL:** <https://forum.katalon.com/t/obtaining-value-from-shadow-root/42934>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [April 30, 2020, 4:26pm UTC](https://forum.katalon.com/t/obtaining-value-from-shadow-root/42934 "2020-04-30T16:26:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexander\_L\_B](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@Alexander\_L\_B](https://forum.katalon.com/u/Alexander_L_B)\
**Post date:** [April 30, 2020, 4:26pm UTC](https://forum.katalon.com/t/obtaining-value-from-shadow-root/42934/1 "2020-04-30T16:26:13Z")

</div>

Hello!!  
I am not an expert programmer so I am struggling here. I would really appreciate a bit of a help! 🙂  
I am trying to figure out how to get or at least verify that a value in this case “8” is inside the div for this shadow root. As far as I understand for now, the logic is similar to an iframe. I have to tell Katalon which is the parent container so that it knows where to look for the shadow root.

I am not being able to make it. Here is how it looks

 ![image](https://europe1.discourse-cdn.com/katalon/original/2X/1/1c0bf0387411ad17b32bc1631f19d1279a32be7b.png)

So I created a test objec called Nitrogen Yield with the following xpath:

//input[@id=‘nitrogen-yield’]

Then I created another test object called Shadow value, with the following xpath : //div[contains(text(),‘8’)] and the previous object called Nitrogen Yield as “Shadow Root Parent”

But when I run a Verify element present on “Shadow value” object, I get as message:  
‘TestObject - ‘Object Repositor/xxxxx/Nitrogen yield’’ is not a shadow root element)

Could someone please explain me how I can verify the 8?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Jass](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/jass/32/9588_2.png) [@Jass](https://forum.katalon.com/u/Jass)\
**Post date:** [May 1, 2020, 3:05am UTC](https://forum.katalon.com/t/obtaining-value-from-shadow-root/42934/2 "2020-05-01T03:05:39Z")

</div>

Hi there

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

- Only for **[Chrome](http://caniuse.com/#feat=shadowdom)** 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 (due to elements do not exist in the DOM).

Jass

---

<div class="post-metadata">

**Author:** ![Lewis-H](https://avatars.discourse-cdn.com/v4/letter/l/49beb7/32.png) [@Lewis-H](https://forum.katalon.com/u/Lewis-H)\
**Post date:** [May 1, 2020, 5:36pm UTC](https://forum.katalon.com/t/obtaining-value-from-shadow-root/42934/3 "2020-05-01T17:36:23Z")

</div>

Here is an example:

var container = document.querySelector(’#example’);  
//Create shadow root !  
var root = container.createShadowRoot();  
root.innerHTML = ‘

Root
Element in shadow

’;

//Access the element inside the shadow !  
//“container.shadowRoot” represents the youngest shadow root that is hosted on the element !  
console.log(container.shadowRoot.querySelector(".test").innerHTML);

Admin

---

<div class="post-metadata">

**Author:** ![daniel.pecimuth](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/daniel.pecimuth/32/16104_2.png) [@daniel.pecimuth](https://forum.katalon.com/u/daniel.pecimuth)\
**Post date:** [August 12, 2021, 8:30pm UTC](https://forum.katalon.com/t/obtaining-value-from-shadow-root/42934/5 "2021-08-12T20:30:19Z")

</div>

Hello Jass,

I have Shadow-root in DOM

 ![image](https://europe1.discourse-cdn.com/katalon/original/3X/1/8/185c0f8f2de74689b7c0077a2d9e19d8bb5087b7.png)

I define a shadow parent like: (//main[contains(@class,‘Detailed’)]//div[@class=‘htmlTemplate’])[1]  
and the shadow object which I need to verify with property like xpath as you see on picture below

 ![image](https://europe1.discourse-cdn.com/katalon/original/3X/7/5/75c377cce3ad8303d813667c002208d2fc3e9cb0.png)

but I am not able to catch the text string …  
Could you pls help me? or navigate me what I did wrong?

Thank you very much.
