How to input text in a text-box that is under Shadow-root in a web page using protractor or selenium? Anything would be helpful. I am trying to enter values in a text-field with xpath and xpath is correct because I have validated it in console.
How to input text in a textbox that is under Shadow-root in a web page using protractor or selenium.
Asked
Active
Viewed 1,108 times
0
-
Can you add a public URL having such use case? – Mrunal Gosar Mar 29 '18 at 16:17
-
1Possible duplicate of [How to handle elements inside Shadow-root](https://stackoverflow.com/questions/37384458/how-to-handle-elements-inside-shadow-root) – Supersharp Mar 29 '18 at 22:06
1 Answers
1
Just using javascript in the web console you can use the following:
document.querySelector('message-list').shadowRoot.querySelector('.textbox').querySelector('textbox').value = 'hello'
To run it with appium you need to use driver.executeScript

eisbehr
- 12,243
- 7
- 38
- 63

Stephen Bates
- 26
- 1
-
Be aware that this will only work if the shadowRoot was created "open" is the developer chooses to do this: `this.attachShadow({mode: 'closed'}); then `element.shadowRoot` will return `null` – Intervalia Aug 06 '18 at 15:37