Link to home
Start Free TrialLog in
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

ASKER CERTIFIED SOLUTION
Avatar of David H.H.Lee
David H.H.Lee
Flag of Malaysia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial