Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Input field with display: none is not interactable at all? #1150

Closed
kam1sh opened this issue Jan 30, 2018 · 2 comments
Closed

Input field with display: none is not interactable at all? #1150

kam1sh opened this issue Jan 30, 2018 · 2 comments
Labels

Comments

@kam1sh
Copy link

kam1sh commented Jan 30, 2018

System

  • Version: geckodriver 0.19.1
  • Platform: Linux 4.14.14-300.fc27.x86_64 (Fedora 27)
  • Firefox: 58.0, installed from @System repo
  • Selenium: Selenium 3.8.0 for Python 3.6, installed from PyPi/pip

Testcase

HTML:

<html>
    <body>
        <form>
            <input style="display: none;" type="file">
            <button type="submit">Upload</button>
        </form>
    </body>
</html>

Python:

from selenium import webdriver
  
def test_input(driver):
    driver.get(r'file:///home/igor/tmp/example.html')
    elem = driver.find_element_by_xpath('//input')
    elem.send_keys(r'/home/igor/stuff/crstest.py')

if __name__ == '__main__':
    driver = webdriver.Firefox()
    test_input(driver)
    driver.quit()

Stacktrace

Traceback (most recent call last):
  File "test_input.py", line 12, in <module>
    test_input(driver)
  File "test_input.py", line 6, in test_input
    elem.send_keys(r'/home/igor/stuff/crstest.py')
  File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/webelement.py", line 352, in send_keys
    'value': keys_to_typing(value)})
  File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/webelement.py", line 501, in _execute
    return self._parent.execute(command, params)
  File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 311, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 237, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotInteractableException: Message: Element <input type="file"> is not reachable by keyboard

Trace-level log

1517311350168   geckodriver     INFO    geckodriver 0.19.1
1517311350170   geckodriver     INFO    Listening on 127.0.0.1:40529
1517311351290   mozrunner::runner       INFO    Running command: "/usr/bin/firefox" "-marionette" "-profile" "/tmp/rust_mozprofile.Ma45fVOyYEFz"
1517311351290   geckodriver::marionette TRACE     connection attempt 0/600
1517311351390   geckodriver::marionette TRACE     connection attempt 1/600
1517311351430   addons.xpi      WARN    Can't get modified time of /usr/lib64/firefox/browser/features/aushelper@mozilla.org.xpi
1517311351489   addons.xpi-utils        WARN    addMetadata: Add-on aushelper@mozilla.org is invalid: [Exception... "Component returned failure code: 0x80520006 (NS_ERROR_FILE_TARGET_DOES_NOT_EXIST) [nsIFile.isFile]"  nsresult: "0x80520006 (NS_ERROR_FILE_TARGET_DOES_NOT_EXIST)"  location: "JS frame :: resource://gre/modules/addons/XPIInstall.jsm :: this.loadManifestFromFile :: line 971"  data: no] Stack trace: this.loadManifestFromFile()@resource://gre/modules/addons/XPIInstall.jsm:971 < syncLoadManifestFromFile()@resource://gre/modules/addons/XPIProvider.jsm:928 < addMetadata()@resource://gre/modules/addons/XPIProvider.jsm -> resource://gre/modules/addons/XPIProviderUtils.js:1176 < processFileChanges()@resource://gre/modules/addons/XPIProvider.jsm -> resource://gre/modules/addons/XPIProviderUtils.js:1523 < checkForChanges()@resource://gre/modules/addons/XPIProvider.jsm:3266 < startup()@resource://gre/modules/addons/XPIProvider.jsm:2172 < callProvider()@resource://gre/modules/AddonManager.jsm:263 < _startProvider()@resource://gre/modules/AddonManager.jsm:730 < startup()@resource://gre/modules/AddonManager.jsm:897 < startup()@resource://gre/modules/AddonManager.jsm:3089 < observe()@jar:file:///usr/lib64/firefox/omni.ja!/components/addonManager.js:65
1517311351490   addons.xpi-utils        WARN    Could not uninstall invalid item from locked install location
1517311351491   geckodriver::marionette TRACE     connection attempt 2/600
1517311351546   Marionette      DEBUG   Received observer notification "profile-after-change"
1517311351586   Marionette      DEBUG   Received observer notification "command-line-startup"
1517311351586   Marionette      INFO    Enabled via --marionette
1517311351591   geckodriver::marionette TRACE     connection attempt 3/600
1517311351691   geckodriver::marionette TRACE     connection attempt 4/600
1517311351791   geckodriver::marionette TRACE     connection attempt 5/600
1517311351891   geckodriver::marionette TRACE     connection attempt 6/600
1517311351992   geckodriver::marionette TRACE     connection attempt 7/600
1517311352092   geckodriver::marionette TRACE     connection attempt 8/600
1517311352192   geckodriver::marionette TRACE     connection attempt 9/600
1517311352252   Marionette      DEBUG   Received observer notification "sessionstore-windows-restored"
1517311352269   addons.xpi      WARN    Can't get modified time of /usr/lib64/firefox/browser/features/aushelper@mozilla.org.xpi
1517311352292   geckodriver::marionette TRACE     connection attempt 10/600
1517311352393   geckodriver::marionette TRACE     connection attempt 11/600
1517311352394   Marionette      DEBUG   Setting recommended pref toolkit.cosmeticAnimations.enabled to false
1517311352394   Marionette      DEBUG   Setting recommended pref datareporting.policy.dataSubmissionPolicyAccepted to false
1517311352394   Marionette      DEBUG   New connections are accepted
1517311352395   Marionette      INFO    Listening on port 34785
1517311352493   geckodriver::marionette DEBUG   Connected to Marionette on localhost:34785
1517311352495   Marionette      DEBUG   Accepted connection 0 from 127.0.0.1:45186
1517311352496   geckodriver::marionette TRACE   <- {"applicationType":"gecko","marionetteProtocol":3}
1517311352496   geckodriver::marionette TRACE   -> 163:[0,1,"newSession",{"acceptInsecureCerts":true,"browserName":"firefox","capabilities":{"desiredCapabilities":{"acceptInsecureCerts":true,"browserName":"firefox"}}}]
1517311352497   Marionette      TRACE   0 -> [0,1,"newSession",{"acceptInsecureCerts":true,"browserName":"firefox","capabilities":{"desiredCapabilities":{"acceptInsecureCerts":true,"browserName":"firefox"}}}]
1517311352498   Marionette      WARN    TLS certificate errors will be ignored for this session
1517311352547   Marionette      DEBUG   Register listener.js for window 2147483649
1517311352556   Marionette      TRACE   0 <- [1,1,null,{"sessionId":"08e08b92-c057-4e3a-92a3-332cdb6516a4","capabilities":{"browserName":"firefox","browserVersion":"58.0" ... lse,"moz:headless":false,"moz:processID":24773,"moz:profile":"/tmp/rust_mozprofile.Ma45fVOyYEFz","moz:webdriverClick":true}}]
1517311352557   geckodriver::marionette TRACE   <- [1,1,null,{"sessionId":"08e08b92-c057-4e3a-92a3-332cdb6516a4","capabilities":{"browserName":"firefox","browserVersion":"58.0","platformName":"linux","platformVersion":"4.14.14-300.fc27.x86_64","pageLoadStrategy":"normal","acceptInsecureCerts":true,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"rotatable":false,"moz:accessibilityChecks":false,"moz:headless":false,"moz:processID":24773,"moz:profile":"/tmp/rust_mozprofile.Ma45fVOyYEFz","moz:webdriverClick":true}}]
1517311352557   webdriver::server       DEBUG   <- 200 OK {"value": {"sessionId":"08e08b92-c057-4e3a-92a3-332cdb6516a4","capabilities":{"acceptInsecureCerts":true,"browserName":"firefox","browserVersion":"58.0","moz:accessibilityChecks":false,"moz:headless":false,"moz:processID":24773,"moz:profile":"/tmp/rust_mozprofile.Ma45fVOyYEFz","moz:webdriverClick":true,"pageLoadStrategy":"normal","platformName":"linux","platformVersion":"4.14.14-300.fc27.x86_64","rotatable":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000}}}}
1517311352558   webdriver::server       DEBUG   -> POST /session/08e08b92-c057-4e3a-92a3-332cdb6516a4/url {"url": "file:///home/igor/tmp/example.html", "sessionId": "08e08b92-c057-4e3a-92a3-332cdb6516a4"}
1517311352558   geckodriver::marionette TRACE   -> 56:[0,2,"get",{"url":"file:///home/igor/tmp/example.html"}]
1517311352567   Marionette      TRACE   0 -> [0,2,"get",{"url":"file:///home/igor/tmp/example.html"}]
1517311352569   Marionette      DEBUG   Received DOM event "beforeunload" for "about:blank"
1517311352579   Marionette      DEBUG   Received DOM event "pagehide" for "about:blank"
1517311352579   Marionette      DEBUG   Received DOM event "unload" for "about:blank"
1517311352580   Marionette      DEBUG   Received observer notification "outer-window-destroyed" for "2147483649"
1517311352776   Marionette      DEBUG   Register listener.js for window 4294967297
1517311352810   Marionette      DEBUG   Check readyState "uninitialized for "about:blank"
1517311352816   Marionette      DEBUG   Received DOM event "DOMContentLoaded" for "file:///home/igor/tmp/example.html"
1517311352826   Marionette      DEBUG   Received DOM event "pageshow" for "file:///home/igor/tmp/example.html"
1517311352839   Marionette      TRACE   0 <- [1,2,null,{}]
1517311352844   geckodriver::marionette TRACE   <- [1,2,null,{}]
1517311352844   webdriver::server       DEBUG   <- 200 OK {"value": {}}
1517311352845   webdriver::server       DEBUG   -> POST /session/08e08b92-c057-4e3a-92a3-332cdb6516a4/element {"using": "xpath", "value": "//input", "sessionId": "08e08b92-c057-4e3a-92a3-332cdb6516a4"}
1517311352845   geckodriver::marionette TRACE   -> 55:[0,3,"findElement",{"using":"xpath","value":"//input"}]
1517311352846   Marionette      TRACE   0 -> [0,3,"findElement",{"using":"xpath","value":"//input"}]
1517311352851   Marionette      TRACE   0 <- [1,3,null,{"value":{"element-6066-11e4-a52e-4f735466cecf":"7b9f2bbf-ce20-4e65-b26c-82efb983a00c","ELEMENT":"7b9f2bbf-ce20-4e65-b26c-82efb983a00c"}}]
1517311352851   geckodriver::marionette TRACE   <- [1,3,null,{"value":{"element-6066-11e4-a52e-4f735466cecf":"7b9f2bbf-ce20-4e65-b26c-82efb983a00c","ELEMENT":"7b9f2bbf-ce20-4e65-b26c-82efb983a00c"}}]
1517311352851   webdriver::server       DEBUG   <- 200 OK {"value":{"element-6066-11e4-a52e-4f735466cecf":"7b9f2bbf-ce20-4e65-b26c-82efb983a00c"}}
1517311352852   webdriver::server       DEBUG   -> POST /session/08e08b92-c057-4e3a-92a3-332cdb6516a4/element/7b9f2bbf-ce20-4e65-b26c-82efb983a00c/value {"text": "/home/igor/stuff/crstest.py", "value": ["/", "h", "o", "m", "e", "/", "i", "g", "o", "r", "/", "s", "t", "u", "f", "f", "/", "c", "r", "s", "t", "e", "s", "t", ".", "p", "y"], "id": "7b9f2bbf-ce20-4e65-b26c-82efb983a00c", "sessionId": "08e08b92-c057-4e3a-92a3-332cdb6516a4"}
1517311352853   geckodriver::marionette TRACE   -> 226:[0,4,"sendKeysToElement",{"id":"7b9f2bbf-ce20-4e65-b26c-82efb983a00c","text":"/home/igor/stuff/crstest.py","value":["/","h","o","m","e","/","i","g","o","r","/","s","t","u","f","f","/","c","r","s","t","e","s","t",".","p","y"]}]
1517311352853   Marionette      TRACE   0 -> [0,4,"sendKeysToElement",{"id":"7b9f2bbf-ce20-4e65-b26c-82efb983a00c","text":"/home/igor/stuff/crstest.py","value":["/","h","o","m","e","/","i","g","o","r","/","s","t","u","f","f","/","c","r","s","t","e","s","t",".","p","y"]}]
1517311352855   Marionette      TRACE   0 <- [1,4,{"error":"element not interactable","message":"Element <input type=\"file\"> is not reachable by keyboard","stacktrace": ... ch/</req<@chrome://marionette/content/listener.js:477:14\ndispatch/<@chrome://marionette/content/listener.js:472:15\n"},null]
1517311352855   geckodriver::marionette TRACE   <- [1,4,{"error":"element not interactable","message":"Element <input type=\"file\"> is not reachable by keyboard","stacktrace":"WebDriverError@chrome://marionette/content/error.js:172:5\nElementNotInteractableError@chrome://marionette/content/error.js:280:5\nwebdriverSendKeysToElement@chrome://marionette/content/interaction.js:464:11\ninteraction.sendKeysToElement@chrome://marionette/content/interaction.js:451:11\nsendKeysToElement@chrome://marionette/content/listener.js:1408:9\ndispatch/</req<@chrome://marionette/content/listener.js:477:14\ndispatch/<@chrome://marionette/content/listener.js:472:15\n"},null]
1517311352856   webdriver::server       DEBUG   <- 400 Bad Request {"value":{"error":"element not interactable","message":"Element <input type=\"file\"> is not reachable by keyboard","stacktrace":"WebDriverError@chrome://marionette/content/error.js:172:5\nElementNotInteractableError@chrome://marionette/content/error.js:280:5\nwebdriverSendKeysToElement@chrome://marionette/content/interaction.js:464:11\ninteraction.sendKeysToElement@chrome://marionette/content/interaction.js:451:11\nsendKeysToElement@chrome://marionette/content/listener.js:1408:9\ndispatch/</req<@chrome://marionette/content/listener.js:477:14\ndispatch/<@chrome://marionette/content/listener.js:472:15\n"}}
1517311352891   Marionette      DEBUG   Closed connection 0
*** UTM:SVC TimerManager:registerTimer called after profile-before-change notification. Ignoring timer registration for id: telemetry_modules_ping
1517311355914   Marionette      DEBUG   Received observer notification "xpcom-shutdown"
1517311355914   Marionette      DEBUG   Resetting recommended pref toolkit.cosmeticAnimations.enabled
1517311355917   Marionette      DEBUG   Resetting recommended pref datareporting.policy.dataSubmissionPolicyAccepted
1517311355917   Marionette      DEBUG   New connections will no longer be accepted

Question

Is this really issue or in Firefox/geckodriver this behavior is by design? Because in chrome it works well...

@andreastt
Copy link
Contributor

Since a user will not be able to interact with a hidden element, WebDriver doesn’t let you either. It sounds like this is a bug in Chrome.

@lock
Copy link

lock bot commented Aug 16, 2019

This issue has been automatically locked since there has not been any recent activity after it was closed. If you have run into an issue you think is related, please open a new issue.

@lock lock bot locked and limited conversation to collaborators Aug 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants