Problem with anchors and targets, for each UI element

Hello

I use for each UI element activity.

For each element I need to download a file by clicking on download button and do something with it depending on the langauge of it. I know the langauge because there is a text on the left side of it like on the attached picture:

I have my for each UI element activity assigned to the name of the langauge so for example:


These green are my elements.

I then store it as a variable: Current Element to string is my var Langauge.

I will then need to do different thing depending on the langauge of the file so that is easy.

The problem is:

I need to click download button at the right of each activity so for English I need to click:

Sometimes these UI elements might be MIXED so then I would have to click:

The problem is that when I do wait for download and my activity click to activate download is clicking on download button then it clicks the first download button for ALL langauges so for example

When my UI element is Russian it still clicks the first one:

I tried to do it like that:

image

by setting my anchor depending on the langauge but it still clicks only the first button.

Any ideas?

@anon40731888
Hello
Viewing your attached SS, you have strict selector which does not use anchors and your selector is going to select tableRow=‘1’ by having in the selector.

Regards

How do I fix it? Should I have fuzzy selector for my anchor and for my target?

image
This are setting of the Anchor.

@anon40731888
I would use fuzzy, select button as target, then country as anchor. Then in anchor, use variable.

Regards

Target fuzzy too? what do you think?

Hi @anon40731888

Give the anchor to language and target to download button. Then use strict selector for language and pass variable in “aaname” attribute.

This is what I currently have. The problem is that it always clicks the first download button for each UI element instead of the needed one.

@anon40731888

Then

  1. initalize count = 1 before for each
  2. Give strict selector to target and pass the count.tostring variable in tableRow attribute.
  3. Increment the count by adding 1

You’ll have to look at the selectors for the languages and buttons and come up with a way to create a dynamic selector to click the correct button. It could be as simple as using Get Attribute to get tableRow from CurrentElement and then use that value in the selector for the button.

This is extra work. It’s simpler just to use Get Attribute to get the tableRow value from CurrentElement.

1 Like

I will get the table row and I should store it as a variable but where do I use it? as for my anchor strict selector?

image
also, there is no table row to select from there, how should I proceed?

Just type in “tableRow”

And yes, you use the tableRow in the selector for the Click activity. Indicate element, click one of the buttons, and add tableRow to the selector. Then put your variable that stores tableRow in place of the static value.

Also, delete the anchor. You don’t need it.

Thank you it works <3!!!

If some other noob like me will try to do it there is one more additional step that made me confused.

When you get attribute and store it as a varaiable you then need to change variable to be text to be able to use it in the selector

1 Like

If you just put your cursor into the “Save to” box and press CTRL+K then type the variable name, it creates the variable with the correct datatype. This works in every activity.

1 Like

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