I am trying to click the image icon via xPath, but when I run the code the link present on image icon is not opening. Could you please help me in resolving this issue?

  • 1
    Would you mind providing the sample html where you got the problem identifying the element?
    – Rao
    Commented Jun 23, 2016 at 11:51

1 Answer 1


Maybe your xpath is wrong. You can use add-on FirePath for Firefox to get the xpath of the image. In order to let the link be clicked, your xpath should end with tag a, not img.

For example, suppose xpath of the image is .//*[@id='navbar_notice_6']/p/a/img, you should remove /img, then your command in java will be:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.