troubleshooting Question

Python selenium question with Jupyter book

Avatar of Hiro 714
Hiro 714 asked on
SeleniumPython
1 Comment1 Solution11 ViewsLast Modified:
I don't know which class should I pick to send a key.
Source HTML
<div class="ChatInput__input"><div class="DraftEditor-root"><div class="public-DraftEditorPlaceholder-root"><div class="public-DraftEditorPlaceholder-inner" id="placeholder-cr5nq" style="white-space: pre-wrap;">Type a chat message, @mention a person, use markdown with /md or enter code with /code</div></div><div class="DraftEditor-editorContainer"><div aria-autocomplete="list" aria-describedby="placeholder-cr5nq" aria-expanded="false" class="notranslate public-DraftEditor-content" role="combobox" spellcheck="true" style="outline: currentcolor none medium; user-select: text; white-space: pre-wrap; overflow-wrap: break-word;" contenteditable="true"><div data-contents="true"><div class="" data-block="true" data-editor="cr5nq" data-offset-key="64jq-0-0"><div data-offset-key="64jq-0-0" class="public-DraftStyleDefault-block public-DraftStyleDefault-ltr"><span data-offset-key="64jq-0-0"><br data-text="true"></span></div></div></div></div></div></div><div class="ChatInput__inputEditorPlugins"></div></div>
Python code
elem_username = browser.find_element_by_class_name('ChatInput__rightContainer')
elem_username.send_keys('Hello')

Error
ElementNotInteractableException           Traceback (most recent call last)
<ipython-input-46-2735539f12ba> in <module>
      1 elem_username = browser.find_element_by_class_name('ChatInput__rightContainer')
----> 2 elem_username.send_keys('tamhiroy@amazon.com')

~\AppData\Roaming\Python\Python38\site-packages\selenium\webdriver\remote\webelement.py in send_keys(self, *value)
    475                 value = self._upload(local_file)
    476
--> 477         self._execute(Command.SEND_KEYS_TO_ELEMENT,
    478                       {'text': "".join(keys_to_typing(value)),
    479                        'value': keys_to_typing(value)}) 
~\AppData\Roaming\Python\Python38\site-packages\selenium\webdriver\remote\webelement.py in _execute(self, command, params)
    631             params = {}
    632         params['id'] = self._id
--> 633         return self._parent.execute(command, params)
    634
    635     def find_element(self, by=By.ID, value=None):

~\AppData\Roaming\Python\Python38\site-packages\selenium\webdriver\remote\webdriver.py in execute(self, driver_command, params)
    319         response = self.command_executor.execute(driver_command, params)
    320         if response:
--> 321             self.error_handler.check_response(response)
    322             response['value'] = self._unwrap_value(
    323                 response.get('value', None)) 
~\AppData\Roaming\Python\Python38\site-packages\selenium\webdriver\remote\errorhandler.py in check_response(self, response)
    240                 alert_text = value['alert'].get('text')
    241             raise exception_class(message, screen, stacktrace, alert_text)
--> 242         raise exception_class(message, screen, stacktrace)
    243
    244     def _value_or_default(self, obj, key, default):

ElementNotInteractableException: Message: Element <div class="ChatInput__rightContainer"> is not reachable by keyboard
ASKER CERTIFIED SOLUTION
David H.H.Lee
Digital Marketing (Hospitality)
Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros