2016-07-22 10 views
3

Selenium (Python)을 사용하여 "ENTER"를 텍스트 필드로 전달하려고합니다. 텍스트 상자는 각각의 전화 번호가 새 줄에 입력해야합니다, 그래서 같은 모양 :Python Selenium - AttributeError : WebElement 객체에 속성이 없습니다. sendKeys

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

내가 가져온 다음 라이브러리 :

from selenium.webdriver.common.keys import Keys 

문제 내가 갖는을 그것은 다음과 같이 실패한다는 것입니다 :

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

누구든지 이것을 해결하는 방법을 알고 있습니까? 솔루션을 찾고 있었지만 아무것도 찾을 수 없었습니다.

+0

에서 [셀레늄]의 첫 번째 예 (http://selenium-python.readthedocs.io/getting-started.html) 문서해야 도움. 또한,'python selenium sendkeys '에 대한 구글 검색은 문제에 관해서 모든 유용한 힌트를 제공합니다. – donkopotamus

답변

9

하면 아래와 WebElement::send_keys() 대신 sendKeys을 사용한 것을 시도 -

from selenium.webdriver.common.keys import Keys 

Webelement.send_keys(Keys.ENTER) 
+1

도움을 주셔서 감사합니다. 저를 위해서 일합니다. – ChrisG29

+0

@Chris 당신을 환영합니다. 셀레늄 바인딩에 대해 배우는 것은 이것에 loo가있다 .. http://selenium-python.readthedocs.io/getting-started.html .. :) –