0

I have looked into all ElementNotInteractableExceptions question, but have not found an answer for my particular case.

            page = r'https://somesite/login.php'
                    driver = webdriver.Firefox ()
                    driver.get (page)
             loginName = driver.find_element_by_css_selector ('#top-login-uname')
                    print(loginName.tag_name)
                    print(loginName.location)
                    loginName.send_keys ('someloginName')  

             print(loginName.tag_name) --> input
             print(loginName.location) --> {'x': 0, 'y': 0}

            Message: Element <input id="top-login-uname" name="login_username" type="text"> is not reachable by keyboard

css_selector finds the element, but for some reason I am getting ElementNotInteractableException.

I have tried using WebDriverWait, but it did not help.

     WebDriverWait (driver, 10).until( EC.presence_of_element_located ((By.CSS_SELECTOR, "#top-login-uname")))  

this is the html line where login is

<input name="login_username" size="25" maxlength="30" value="" tabindex="101" type="text">
Ian Lesperance
  • 4,961
  • 1
  • 26
  • 28
LetzerWille
  • 5,355
  • 4
  • 23
  • 26
  • It found the element, but the error seems to imply that you can't use `send_keys` for that element because it's not interactable. You may want to look for wrappers of that element that actually are interactable. – sytech Mar 05 '18 at 23:51
  • @sytech, thanks. Where I could look into the wrappers? – LetzerWille Mar 05 '18 at 23:55
  • Hard to say concretely, but I would start at the element you have and work your way up the DOM hierarchy. Basically, you're looking for the element that directly receives the keyboard input. Usually it's the same as the clickable element over the input element. IE the DOM object that's highlighted when you right-click and inspect in your browser. – sytech Mar 06 '18 at 00:01
  • Or, if it's a waiting issue, perhaps what you need is to wait on `EC.element_to_be_clickable` rather than `precense_of_element_located` since we established the element is, in fact, present. You can also try a dumb wait (ie `time.sleep`) and see if that works to tell if it's a waiting issue at all. – sytech Mar 06 '18 at 00:03
  • @sytech, I have used as you suggested WebDriverWait (driver, 20).until (EC.element_to_be_clickable ((By.CSS_SELECTOR, "#top-login-uname"))), and got TimeoutException.... – LetzerWille Mar 06 '18 at 00:54
  • @DebanjanB, yes it may very well be a duplicate. I have looked into your solution... It uses document.getElementsById, but I need to access name="login_username", and there is no getElementsByName .... I need a hint, it is just my second day into Selenium. – LetzerWille Mar 06 '18 at 12:55

0 Answers0