【问题标题】:How can I click on the link here with using id.class.href python selenium, I using pyCharm [closed]如何使用 id.class.href python selenium 单击此处的链接,我使用 pyCharm [关闭]
【发布时间】:2017-04-16 19:08:28
【问题描述】:

如何使用 id.class.href python selenium 点击此处的链接,我使用 pyCharm *href is Changeable

我试试 driver.find_element_by_xpath("//div[@id='result_26']//a[@class='a-link-normal s-access-detail-page s-color-twister-title-link a-text-normal']/@href").click() enter image description here

【问题讨论】:

    标签: python class selenium-webdriver href


    【解决方案1】:

    您点击的是 href 属性,而不是<a> 标签

    假设您的 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')]").click() 我尝试 * 和 dosnt 工作
    • 我做了 element2 = driver.find_element_by_xpath("//li[@id='result_26']") element2.find_element_by_xpath(".//a[@class='a-link-normal s -access-detail-page s-color-twister-title-link a-text-normal']").click()
    猜你喜欢
    • 1970-01-01
    • 2020-09-23
    • 1970-01-01
    • 2021-12-03
    • 1970-01-01
    • 2017-12-25
    • 2020-04-13
    • 1970-01-01
    • 2023-03-31
    相关资源
    最近更新 更多