1

My code :

from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.by import By
driver=webdriver.Firefox()
driver.get("http://www.58yumi.com/")
driver.find_element_by_id("UserName").send_keys("XXXXXXX")
driver.find_element_by_id("Password").send_keys( "XXXXXX")
driver.find_element_by_xpath("//*[contains(@type,'submit')]").click()
driver.get("http://www.58yumi.com/user_jiexi.htm")
driver.find_element_by_id("cznr").sendKeys("XXXX.com|forcname|CNAME|forcname.XXXX.com.a.bdydns.com|default");
......

I get error in element_by_id("cznr") :

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'WebElement' object has no attribute 'sendKeys'

html :

<textarea id="cznr" onkeyup="czhang();" name="ymlb" cols="60" class="inputs2" rows="10"></textarea>

Help .... How to input data in textarea ?

2
  • Sorry change Question .... Commented Dec 28, 2018 at 6:19
  • Please don't edit the question based on which you have received well researched answers. Once you receive canonical answers changing the question can make all the answers invalid and may not be useful to future readers. If your requirement have changed feel free to raise a new question. StackOverflow contributors will be happy to help you out. For the time being I have reverted back the question to it's initial state. Commented Dec 28, 2018 at 6:25

2 Answers 2

1

Replace sendKeys() which is Java based method with Python based method send_keys() in the line:

driver.find_element_by_id("cznr").sendKeys("XXXX.com|forcname|CNAME|forcname.XXXX.com.a.bdydns.com|default");
Sign up to request clarification or add additional context in comments.

Comments

0

You're using the wrong function name -- sendKeys vs. send_keys.

You must have copied that line from a Java sample program, which does use sendKeys as the function name.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.