当我尝试将 key 发送到输入字段时,出现错误(元素不可交互)。当我尝试仅单击输入字段时,我可以执行此操作,但是在提供文本时,它显示错误,我有很多事情可以解决此问题,但我只收到此错误。
我的代码:
from selenium import webdriver
Driver=webdriver.Chrome()
Driver=get('https://YouTube.com')
Box=Driver.find_element_by_xpath('//*[@id="search-input"]')
Box.send_keys('music') ```
最佳答案
搜索栏是 div 类(search-input)中的 input(id=search)。试试这个;
from selenium import webdriver
Driver=webdriver.Chrome()
Driver.get('https://YouTube.com')
Box=Driver.find_element_by_id('search-input').find_element_by_id('search')
Box.send_keys('music')
关于python - 出现错误 :(Element not interactable) when sending keys into the input field in selenium python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64306572/