如何使用id.class.href python selenium单击此处的链接

如何使用id.class.href python selenium单击此处的链接,python,class,selenium-webdriver,href,Python,Class,Selenium Webdriver,Href,如何使用id.class.href单击此处的链接?python selenium,I使用pyCharm*href是可更改的 我试着 driver.find_element_by_xpath(//div[@id='result\u 26']//a[@class='a-link-normal s-access-detail-page s-color-twister-title-link a-text-normal']/@href”)。单击() 您正在单击href属性,而不是标记 假设您的xpath是

如何使用id.class.href单击此处的链接?python selenium,I使用pyCharm*href是可更改的

我试着
driver.find_element_by_xpath(//div[@id='result\u 26']//a[@class='a-link-normal s-access-detail-page s-color-twister-title-link a-text-normal']/@href”)。单击()

您正在单击href属性,而不是
标记


假设您的xpath是正确的,只需从末尾删除
/@href
,它就可以理想地工作。

driver.find_element_by_xpath(//div[@id='result_26']/*[contains(@class,'a-link-normal s-access-detail-page s-color-twister-title-link a-text-normal')))。单击()i try*和dosnt workI did element=driver.find_element_by_xpath(“//li[@id='result_26']”)element2.通过xpath(“.//a[@a-link-normal s-access-detail-page s-color-twister-title-link a-text-normal'])查找元素。单击()