Selenium中的send_键存在问题

Selenium中的send_键存在问题,selenium,Selenium,我正在尝试使用Selenium填充文本框 description=driver.find_element_by_xpath("//*[contains(text(), 'add description')]") description.click() description = driver.find_element_by_xpath("//*[@type='text']") description.send_keys(""+str(description)) 出于某种原因,descript

我正在尝试使用Selenium填充文本框

description=driver.find_element_by_xpath("//*[contains(text(), 'add 
description')]")
description.click()
description = driver.find_element_by_xpath("//*[@type='text']")
description.send_keys(""+str(description))
出于某种原因,description的变量值不会传递给textbox,而是传递给webelement id和session id,即:

<selenium.webdriver.remote.webelement.WebElement (session="f2943bc99f2fbbec90c3fa9c0cb68e20", element="0.3535547756904527-5")>

有人能帮我吗

尝试使用以下代码:

description.send_keys("""Just a testing """)

description.send_keys(str(description.text))

如果我正确理解了您的代码,“description”包含一个web元素。因此,您的
send\u键本质上是以字符串形式键入web元素

从(非官方)文件中:

通过xpath(xpath)查找元素 通过xpath查找元素

Args:xpath-要查找的元素的xpath定位器

返回:WebElement-找到的元素

引发:NoSuchElementException-如果找不到元素

用法:element=driver。通过xpath(“//div/td[1]”查找元素

驱动程序。通过xpath(“您的xpath”)查找元素。发送密钥(“您的xpath”)