In Object Properties - Condition : ends with does not work

Hi,

In Object Repo for an item settings in Objects Properties when use condition ‘ends with’ it does not work.
I have used other xpath which works but as development continuing xpath always get change and it not possible to change all these xpaths. only reliable solution is to use the ends with condition but it seems that ends with command does not work. In addition to that ‘matches regex’ command also does not work.

i.e //a[ends-with(@href, ‘/action/people’)]

please find the attached screenshot.

tested in -
Katalon V 7.0.0.rc1
Katalon V 6.3.3 Build: 11

Selenium use browser’s XPath engine by default. Most browsers support XPath 1.0 only, and ends-with is only available in XPath 2.0.

1 Like

Try a CSS selector:

a[href$='/action/people']
1 Like

Hi Thomas,

Thanks for your suggestion. so, this CSS selector is conversion of above Xpath or is it works like ‘ends with’ command?

Thanks in advance.

I suppose you could say that, if it helps you understand. However, it’s just CSS <- browsers use HTML, CSS and JavaScript - they don’t use Xpath. CSS selectors are highly optimized (although, that makes little difference in a testing environment).

Yes.

Syntax Meaning
$= ends with
^= starts with
~= contains
= exactly what you think it means :wink:

So, a[href$='/action/people'] means,

"find an a-element that has an href attribute that ends with /action/people"

2 Likes

css voodoo in full glory :slight_smile:
@mohammad.zaman on the w3schools you can find very good docs on how css selectors works

1 Like

Thank you all, for your quick response on this…

Did we solve the problem?

Yes. Thank you.