【发布时间】:2019-07-25 18:37:41
【问题描述】:
我无法正确使用发送键来输入值。
我希望能够在文本框中插入文本。
尝试了两种不同的方法
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument('--ignore-certificate-errors')
options.add_argument("--test-type")
driver = webdriver.Chrome('/Users/.../Documents/chromedriver')
driver.get('http://codepad.org/')
text_area = driver.find_element_by_id('textarea')
text_area.send_keys("This text is send using Python code.")
from selenium import webdriver
driver = webdriver.Chrome('/Users/.../Documents/chromedriver')
driver.get( 'https://www.google.com/maps/dir///@36.0667234,-115.1059052,15z')
driver.find_element_by_xpath("//*[@placeholder='Choose starting point, or click on the map...']").click()
driver.find_element_by_xpath("//*[@placeholder='Choose starting point, or click on the map...']").clear()
driver.find_element_by_xpath("//*[@placeholder='Choose starting point, or click on the map...']").send_keys("New York")
在我试图将值放入的字段中输入一个值
【问题讨论】:
-
你遇到了什么错误?两个代码对我来说都很好。
标签: python-3.x selenium web-scraping beautifulsoup