question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to access input elements under shadow root with driver.inputFile()

See original GitHub issue

Hi, I’m a little new to contributing to open source so wasn’t super sure how to get started based off the info provided in the wiki (Do I make a new branch or should I fork everything then make a PR to develop? etc. Just want to make sure I’m following the proper process)

Regardless, I ran into the same issue as https://stackoverflow.com/questions/65401960/upload-file-using-vaadin-upload-component and realized vaadin-upload/input elements are always placed into the shadowRoot. After looking into the source code, I saw that driver.inputFile() locates the element using elementId(), which in turn calls getRootNodeId(), which finally calls method("DOM.getDocument") here. Looking at the Chrome DevTools Protocol there’s an optional parameter pierce that determines whether or not iframes and shadow roots should be traversed when returning the subtree (default is false).

My idea was to add and set pierce to true to make elements in iframes/shadow roots available and allow those selectors to be located when using the driver.inputFile() method.

With this in mind I have two questions:

  1. Does this make sense?
  2. How can I help add/do this?

Thanks!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ptrthomascommented, Jul 31, 2021

@eeelinn this totally makes sense, and please submit a PR: https://github.com/intuit/karate/blob/master/.github/CONTRIBUTING.md

I would request that you add a test to the suite we have, and there is one flow already for a Chrome file-upload, within an iframe: https://github.com/intuit/karate/blob/v1.1.0.RC5/karate-e2e-tests/src/test/java/driver/08.feature - it may make sense to create a new test for shadow dom complications in general.

0reactions
ptrthomascommented, Aug 4, 2021

@eeelinn awesome. this means I’ll probably release 1.1.0 right away.

if you have ideas for long term making shadow-dom traversal easier do consider contributing + discussing, thx !

Read more comments on GitHub >

github_iconTop Results From Across the Web

ElementNotInteractableException when using sendKeys with ...
I'm getting Element <input id="username" type="text"> is not reachable by keyboard when trying to fill that input with text via sendKeys.
Read more >
Input element created under #shadow-root, unable to style it
It works differently in all the browsers because the file input type is quite special. What browser do you use?
Read more >
How to access an Input file in the shadow DOM using ...
I am trying to access the input element so I can bypass the file browser dialog. I am using selenium webdriver V3 and...
Read more >
Working with Shadow DOM Elements using Webdriver
When we try to find Shadow DOM elements using selenium locators, it will throw 'NoSuchElementException'. To access these Shadow DOM elements ...
Read more >
Karate UI
click(). Just triggers a click event on the DOM element: * click('input[name=someName]').
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found