How to input text in a textbox that is under Shadow-root in a web page using protractor or selenium.

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



How to input text in a textbox that is under Shadow-root in a web page using protractor or selenium.



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.





Can you add a public URL having such use case?
– Mrunal Gosar
Mar 29 at 16:17





Possible duplicate of How to handle elements inside Shadow-root
– Supersharp
Mar 29 at 22:06




1 Answer
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





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 6 at 15:37


this.attachShadow(mode: 'closed'); then


null






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Creating a leaderboard in HTML/JS