在这个网页上,有一个按钮,我需要按下。这是HTML源代码:
<summary aria-controls="dc_2" tabindex="0" role="button" aria-expanded="false"><span>The company I am travelling with is not listed</span>
我尝试使用span标记的XPATH访问它,但是它不起作用。有什么建议吗
这是我的代码:
span = '/html/body/main/section[2]/section/div[2]/form/details/summary/span'
driver.find_element_by_xpath(span).click()
我不确定,必须使用开发工具查看页面,但这可能会起作用:
另外,强烈建议不要使用绝对XPath和绝对CSS选择器。他们非常不可靠
相关问题 更多 >
编程相关推荐