Avatar of Hiro 714
Hiro 714
 asked on

Python selenium question with Jupyter book

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>

Open in new window

Python code
elem_username = browser.find_element_by_class_name('ChatInput__rightContainer')
elem_username.send_keys('Hello')

Open in new window


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

Open in new window

SeleniumPython

Avatar of undefined
Last Comment
David H.H.Lee

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
David H.H.Lee

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck