我试图用xpath表达式在我的网页中选择一个元素。在
这是代码的基本部分
from selenium import webdriver
...
driver = webdriver.Chrome()
...
xpath = "//select[@onchange='onCodeChanged('14', this);']/option[text()='CPT 99429']"
e = driver.find_element_by_xpath(xpath)
e.click()
我要选择的部分页面源:
^{pr2}$错误:
SyntaxError: Failed to execute 'evaluate' on 'Document': The string '//select[@onchange='onCodeChanged('14', this);']/option[text()='CPT 99429']' is not a valid XPath expression.
我有一种感觉,这与引号或;符号有关,因为我已经成功地使用了同样的方法在网页中选择元素,但是现在得到了这个错误。在
目前没有回答
相关问题 更多 >
编程相关推荐