ElementNotInteractableException when using sendKeys on an input type=file inside a shadow root
Categories
(Remote Protocol :: Marionette, defect, P5)
Tracking
(Not tracked)
People
(Reporter: artur, Unassigned)
References
(Depends on 1 open bug, Blocks 1 open bug)
Details
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36 Steps to reproduce: 1. Have a page with a `<input type=file>` directly in the body and another one inside a shadow root 2. Use WebDriver to upload a file to the input in the body 3. Use WebDriver to upload a file to the input in the shadow root Actual results: Setting the file name for the input in the body succeeds. Setting the file name for the input in the shadow root (` uploadInBody.sendKeys(file1.getPath());`) fails with "ElementNotInteractableException" Expected results: `sendKeys` should work the same when the input is inside a shadow root
Can be reproduced using https://github.com/Artur-/selenium-firefox-shadowdom
Comment 2•6 years ago
|
||
WebDriver doesn’t really support shadow DOM yet, so that would have to be addressed first. There’s more discussion about this in https://github.com/w3c/webdriver/pull/1320.
Updated•6 years ago
|
Comment 4•6 years ago
|
||
FWIW, not being able to query shadow DOM in webdriver is a separate issue to not being able to send keys to shadowRoot input elements. I'm currently getting the input from an element's shadow dom by leveraging a raw script:
return arguments[0].shadowRoot.querySelectorAll('input')
I can then convert the result back into an element, and send keys to it (works fine in Chrome, errors in Firefox).
Comment 5•6 years ago
|
||
(In reply to lukebjerring from comment #4)
FWIW, not being able to query shadow DOM in webdriver is a separate issue to not being able to send keys to shadowRoot input elements. I'm currently getting the input from an element's shadow dom by leveraging a raw script:
return arguments[0].shadowRoot.querySelectorAll('input')
I can then convert the result back into an element, and send keys to it (works fine in Chrome, errors in Firefox).
This sounds like Chrome is not actually doing the interactability checks properly as the mechanisms the spec uses have not had behaviour defined when looking into it.
E.g. document.elementFromPoint(x, y) will return the shadowRoot element and not the element defined inside the shadowRoot
Updated•2 years ago
|
Comment 7•2 years ago
|
||
I've just tested our Element Send Keys
implementation and it works all fine with elements from within a shadow root (workaround from comment 4), including file input elements.
1671651822505 Marionette DEBUG 3 -> [0,3,"WebDriver:FindElement",{"value":"input","using":"id"}]
1671651822508 Marionette TRACE [12] MarionetteCommands actor created for window id 4294967298
1671651822512 Marionette DEBUG 3 <- [1,3,null,{"value":{"element-6066-11e4-a52e-4f735466cecf":"8b931da2-14d5-40df-8695-fb0ad500eb39"}}]
1671651822512 Marionette DEBUG 3 -> [0,4,"WebDriver:GetShadowRoot",{"id":"8b931da2-14d5-40df-8695-fb0ad500eb39"}]
1671651822513 Marionette DEBUG 3 <- [1,4,null,{"value":{"shadow-6066-11e4-a52e-4f735466cecf":"653bc565-6705-42e7-b592-5c8ad61ed21b"}}]
1671651822518 Marionette DEBUG 3 -> [0,5,"WebDriver:ExecuteScript",{"script":"const shadow_root = arguments[0];\n const elem = shadow_root.querySelector(\"input\");\n return elem","args":[{"shadow-6066-11e4-a52e-4f735466cecf":"653bc565-6705-42e7-b592-5c8ad61ed21b"}],"newSandbox":true,"sandbox":"default","line":155,"filename":"_a/test_minimized.py"}]
1671651822519 Marionette DEBUG 3 <- [1,5,null,{"value":{"element-6066-11e4-a52e-4f735466cecf":"81bab01a-7c04-4d95-a975-0a505e329485"}}]
1671651822519 Marionette DEBUG 3 -> [0,6,"WebDriver:ElementSendKeys",{"id":"81bab01a-7c04-4d95-a975-0a505e329485","text":"///Users/marionette/LICENSE"}]
1671651822524 Marionette DEBUG 3 <- [1,6,null,{"value":null}]
1671651822524 Marionette DEBUG 3 -> [0,7,"WebDriver:GetElementProperty",{"id":"81bab01a-7c04-4d95-a975-0a505e329485","name":"value"}]
1671651822525 Marionette DEBUG 3 <- [1,7,null,{"value":"C:\\fakepath\\LICENSE"}]
As of now this shouldn't be a problem anymore, and as such I'm going to close this issue.
Updated•2 years ago
|
Description
•