Python Selenium-AttributeError:WebElement对象没有属性sendKeys [英] Python Selenium - AttributeError : WebElement object has no attribute sendKeys

查看:1385
本文介绍了Python Selenium-AttributeError:WebElement对象没有属性sendKeys的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Selenium(Python)将"ENTER"传递到文本字段.文本框要求在新行中输入每个电话号码,因此它将类似于:

I'm trying to pass through "ENTER" to a text field, using Selenium (Python). The text box requires that each phone number be entered on a new line, so it will look something like:

#Add the phone number#
Webelement.sendKeys(Keys.ENTER)

我已导入以下库:

from selenium.webdriver.common.keys import Keys

我遇到的问题是它失败:

The problem I'm getting is that it fails with:

AttributeError:"WebElement"对象没有属性"sendKeys"

AttributeError: 'WebElement' object has no attribute 'sendKeys'

有人知道如何解决这个问题吗?我一直在寻找解决方案,但找不到任何东西.

Does anyone know how to resolve this? I've been searching for a solution, but haven't been able to find anything.

推荐答案

尝试使用

Try using WebElement::send_keys() instead of sendKeys as below :-

from selenium.webdriver.common.keys import Keys

Webelement.send_keys(Keys.ENTER)

这篇关于Python Selenium-AttributeError:WebElement对象没有属性sendKeys的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆