Simi
Simi

Reputation: 11

Element <input> is not reachable by keyboard - InputField under ShadwoRoot

I use newest Chrome and chromedriver.
I have a website with DOM elements and i will type any text in an inputfield
HTML Code (sorry for screenshot) enter image description here

Python Code:
#Expand Shadow
def expand_shadow_element(element):
shadow_root = driver.execute_script('return arguments[0].shadowRoot.children', element)
return shadow_root
...
root1 = driver.find_element_by_id("UI-tf_Vorgangsname")
shadow_root1 = expand_shadow_element(root1)
root2 = shadow_root11.find_element_by_xpath("//input[@part='value']")
time.sleep(2)
root2.click()
time.sleep(2)
root2.send_keys('testssdfs')

I become this messages:
selenium.common.exceptions.ElementNotInteractableException: Message: Element is not reachable by keyboard

I see, click is working, cursor is aktiv in Input Field, but send_keys doesn't work.
enter image description here
Do you have any idea?
Many Thanks!

Upvotes: 0

Views: 155

Answers (1)

Simi
Simi

Reputation: 11

I have a solution.
Sendkeys doesn't work, but i found a hybrid solution.
I use this Python script without send_keys, and i use robotframework kernsystem.
xy.robot file
...
${Element}= Get Element ID Input UI-tf_Vorgnagsname
Press Keys ${Element} Test text
...
So i can write in this input field.

Upvotes: 0

Related Questions