Selecting 'Closest matches' for selectors?

Hey,

I have created a bot which uses a variable in ‘aaname’ to dynamically click different objects on a portal based on what is required. The bot gets the value it is looking for in a JSON object and then clicks it on the website list.

The problem I have found: one of the options on the website is written exactly the same, except the creators of the website have accidentally added a double space between two of the words.

So: the bot is looking for 'Bricks woven fabric - Titanium/Palladium black', but the website had 'Bricks woven fabric - Titanium/Palladium black' (double space before black). It has then thrown out a ‘99% match’ suggestion of the closest thing (which is the result I want).

Is there a way that I can change the margin of error so that if it fails, it clicks on the 99% match? I would program it so that it looks for the double spaced option in this case, but the issue could occur again and there are thousands of potential things it needs to click.

Any suggestions would be much appreciated! Thanks.

Hello @dr1992
Try this

"Bricks woven fabric - Titanium/Palladium black*"

***** refers any value at end or begining of String

That won’t work, since - as he explained - there are thousands of different possible values that may have slight differences.

In your click activity, set it to only use the Fuzzy Selector. Then when indicating the element, select “InnerText is…” and you can then play with the accuracy which in this case is 50%

image

After letting it save these settings to your click activity, you can manually replace the text (in the Fuzzy Selector) with your variable for both aaname and “check:innerText=”

1 Like

Thank you for this postwick, you got me onto ‘fuzzy selectors’, which is exactly what I needed.

I was able to use a variable in the click activity to get the nearest match; it was like so, for anyone interested:

<webctrl aaname='{{VARIABLE}}' parentid='root' tag='SPAN' matching:aaname='fuzzy' fuzzylevel:aaname='0.9' />

The matching tag lets you set a fuzzy selector and the fuzzylevel 0.9 determines the accuracy (scale is 0 - 1 and doesn’t allow beyond 1 decimal place). I placed this as an exception within a try-catch if it fails to click the right option.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.