for i in range (1,6):
col = driver.find_elements_by_tag_name("td")
for j in range (1,7):
xpath_string = ('/html/body/div[3]/ul/li[1]/div/div[1]/table/tbody/**tr[{0}]**/**td[{1}]**'.format(str(j), str(i)))
day = driver.find_element_by_xpath(xpath_string)
B = day.text
print(B)
if (Date == B):
path_string = ('/html/body/div[3]/ul/li[1]/div/div[1]/table/tbody/**tr[{0}]**/**td[{1}]**'.format(str(j), str(i)))
say = driver.find_element_by_xpath(path_string)
say.click()
break
类型错误:
Failed to execute 'evaluate' on 'Document': The result is not a node set, and therefore cannot be converted to the desired type.
它显示了这种类型的错误,所以请帮助我解决这个问题。你知道吗
在xpath中
**
的用途是什么,它们不是有效的xpath表达式。以下代码行应更改如下:您是否尝试将xpath直接传递到driver.find\元素\u by\ xpath()而不是先将其格式化为字符串?你知道吗
我想象它会像这样:
相关问题 更多 >
编程相关推荐