I am running some cucumber features using capybara and I need to check if a certain image is being shown.
I tried this xpath match but apparently the function matches is not available:
//img[matches(@src, "my_image.png")]
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You don’t need any
matchesfunction. Use:Or, if the path can include text before the portion you want to match:
This second expression imitates an
ends-withfunction.If you don’t like hard-coding the substring length, then use:
For completeness: in some cases, the following is acceptable: