0

There is a website with an image button on it which I am trying to click using selenium. The code for this from inspecting the element is:

<img src="../images/aaa.gif" width="100px" height="100px" border="0" alt="aaa">

I know how to use find_element_by_name, id, etc...but am unsure how what to use to click the above. Could anyone advise please?

PS. The image also has a href on a seperate line of code if that makes things simpler?

2 Answers 2

2

It the image is always exactly the same, try this xpath:

//img[@src="../images/aaa.gif"]
Sign up to request clarification or add additional context in comments.

1 Comment

Or with text on the page?
1

If the image always has the same ALT attribute you can also use the CSS selector, img[alt='aaa'].

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.