seleniumxpathidekantukatalon

Find xpath of element knowing a part of href attribute only selenium ide ui vision katalon recorder


I need to detect via xpath an element (image with href) but i know a part of href only

This is the html

<a href="/mysite.com?id=123456"><img src="//user/banners/16/08/1614708.gif" alt="AAA" data-tip="BBB" currentitem="false" class="" width="468" height="60"></a>

I know the id 123456 (part of href)

I tried this xpath that recognize element with a part of href but working in text link only

xpath=//a[contains(@href, "123456")]

How can i detect the element using a part of href only ?

I need xpath only please.


Solution

  • You need get /img in //a where href attribute contains() or ends-with() your id This is XPATH that you need. At least i would use this XPATH in this situation

    //a[ends-with(@href, 'your-id-here')]/img