【发布时间】:2020-04-01 04:07:36
【问题描述】:
我正在使用此代码,但我无法选择输入字段。
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome()
driver.get("https://10fastfingers.com/multiplayer")
input("Start : ")
a = "b"
inputfield = driver.find_element_by_xpath("//input[@type='text']")
inputfield.click()
while a == "b":
try:
word = driver.find_element_by_xpath("//span[@class='highlight']")
inputfield.send_keys(word.text)
inputfield.send_keys(Keys.SPACE)
except:
print("Finish")
a = "c"
输入字段元素;
<input type="text" autofocus="autofocus" autocapitalize="none" autocorrect="off">
【问题讨论】:
标签: python selenium selenium-webdriver xpath