Search code examples
pythonclassselenium-webdriverhref

How can I click on the link here with using id.class.href python selenium, I using pyCharm


How can I click on the link here with using id.class.href python selenium, I using pyCharm *href is Changeable

i try 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


Solution

  • You are clicking the href attribute instead of the <a> tag.

    Assuming your xpath is correct, just remove the /@href from the end and it should ideally work.