我正在尝试使用 Selenium
(Python) 将“ENTER”传递给文本字段。文本框要求在新行中输入每个电话号码,因此它看起来像:
#Add the phone number#
Webelement.sendKeys(Keys.ENTER)
我导入了以下库:
from selenium.webdriver.common.keys import Keys
我遇到的问题是它失败了:
AttributeError: 'WebElement' object has no attribute 'sendKeys'
有人知道怎么解决吗?我一直在寻找解决方案,但一无所获。
最佳答案
尝试使用 WebElement::send_keys()
而不是 sendKeys
如下:-
from selenium.webdriver.common.keys import Keys
Webelement.send_keys(Keys.ENTER)
关于Python Selenium - 属性错误 : WebElement object has no attribute sendKeys,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38521136/