gpt4 book ai didi

python - Selenium - WebElement 对象没有属性 'sendKeys'

转载 作者:行者123 更新时间:2023-11-30 22:25:02 26 4
gpt4 key购买 nike

我正在尝试使用 selenium 在输入字段中输入文本,但出现错误。代码是:

input1 = browser.find_element_by_xpath('//*[@id="login-dialog dialog"]/div[2]/div[2]/div[2]/form/div[1]/input')
input1.sendKeys("myusername")

但是它给出了这个错误

Traceback (most recent call last):
File "C:\Users\Bradley Jo\Desktop\Project\app.py", line 14, in
<module>
input1.sendKeys("hello")
AttributeError: 'WebElement' object has no attribute 'sendKeys'

最佳答案

该方法不是sendKeys。这是send_keys。

input1 = browser.find_element_by_xpath('//*[@id="login-dialog dialog"]/div[2]/div[2]/div[2]/form/div[1]/input')
input1.send_keys("myusername")

关于python - Selenium - WebElement 对象没有属性 'sendKeys',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47653904/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com