Find the same inscriptions on the page one by one, and click on each

Hello.
I need to find the same caption “Illustration” on the page one by one, and click on each.
I made this record.
Please help me make a loop, I have more than a hundred buttons on the page.
{
“Name”: “1”,
“CreationDate”: “2020-3-14”,
“Commands”: [
{
“Command”: “type”,
“Target”: “id=type_2_78976883”,
“Value”: “2”
},
{
“Command”: “click”,
“Target”: “id=type_2_78976883”,
“Value”: “”
},
{
“Command”: “click”,
“Target”: “id=type_2_78976882”,
“Value”: “”
},
{
“Command”: “type”,
“Target”: “id=type_2_78976868”,
“Value”: “2”
},
{
“Command”: “click”,
“Target”: “id=type_2_78976868”,
“Value”: “”
},
{
“Command”: “type”,
“Target”: “id=type_2_78976867”,
“Value”: “2”
},
{
“Command”: “click”,
“Target”: “id=type_2_78976867”,
“Value”: “”
}
]

Here solution to detect element that changing, your is a simple case

Read here
https://ui.vision/rpa/docs/selenium-ide/click

Thank you, this partially helped, but when repeating this code it finds only the first button over and over again. How to make him look for the next?

{
“Name”: “4”,
“CreationDate”: “2020-3-15”,
“Commands”: [
{
“Command”: “type”,
“Target”: “//[contains(@id, ‘type_2_’)]",
“Value”: “2”
},
{
“Command”: “click”,
“Target”: "//
[contains(@id, ‘type_2_’)]”,
“Value”: “”
}
]
}

Post url page page i need to see the button and i create for you the code

Thanks for the offer of help, I really appreciate it, but this page is locked by authorization. I can copy the code from chrome.
type_2_78976883 - identifier
type_2_ type_2_ a common part

                                        <div class="form-group">
                        <label for="type_78976883" class="col-sm-4 control-label">Image Type</label>
                        <div class="col-sm-8" style="margin-top:5px;">
                            <span class="radio checkbox-inline">
                                <input name="type" id="type_1_78976883" type="radio" value="1">
                                <label for="type_1_78976883">Photo</label>
                            </span>
                            <span class="radio checkbox-inline">
                                <input name="type" id="type_2_78976883" type="radio" value="2" checked="checked">
                                <label for="type_2_78976883">Illustration</label>
                            </span>
                        </div>
                    </div>
                                                            <input name="is_enhanced" type="hidden" value="on">
                                    <div class="form-group">
                    <div class="col-sm-offset-4 col-sm-8 text-center">
                        <ul class="list-inline">
                            <li>
                                <span class="btn btn-danger btn-delete" data-toggle="confirm" data-original-title="" title="">
                                    <span class="cspicon icon-trash"></span>
                                    <span>&nbsp;Delete</span>
                                </span>
                            </li>
                        </ul>
                    </div>
                </div>


Try in this mode change [n] with element number from 1 to 100 or more

Type command before click command have not have function you can remove it.

Macro code

{
"Command": "click",
"Target": "xpath=//[contains(@id, ‘type_2_’)][1]",
"Value": ""
},
{
"Command": "click",
"Target": "xpath=//[contains(@id, ‘type_2_’)][2]",
"Value": ""
},
{
"Command": "click",
"Target": "xpath=//[contains(@id, ‘type_2_’)][3]",
"Value": ""
},
{
"Command": "click",
"Target": "xpath=//[contains(@id, ‘type_2_’)][4]",
"Value": ""
},
{
"Command": "click",
"Target": "xpath=//[contains(@id, ‘type_2_’)][5]",
"Value": ""
},

You can create a solution more simply using loop command [${Loop_Counter}] need only incremental command to loop counter.

Try the code

this syntax does not work

  • Playing macro 1

  • [info]

Executing: | click | xpath=//[contains(@id, ‘type_2_’)][1] | |

  • [error]

timeout reached when looking for element ‘xpath=//[contains(@id, ‘type_2_’)][1]’

  • [info]

Macro failed (Runtime 10.19s)

There are more different solution to click a button but without the url page is very hard create a macro code.

I suggest a solution that works in all sites.

Use Xclick to click an element near the button you need to click, in this mode you set the focus, after use Xtype with KEY_TAB to move in next element.

When you reach the button you need to click try to click it with Xtype and KEY_ENTER

This solution required xmodules installed

https://ui.vision/rpa/x/download

Without url page is very hard to help you becase i can not see alternative xpath, frame and i can not try macro code.

With Xclick is more simply to solve your problem (xclick with image working always)

https://ui.vision/rpa/docs/xclick

I tried using visual recognition, but I did not find how to move the page, the PgUp and Key Up commands do not work.

I saved the page and packed in rar canstock.rar - Google Drive

for some reason this is not working it gives an error
“Target”: "xpath=//[contains(@id, ‘type_2_’)]

and this does not give out, but always finds only the first button
“Target”: “// *[contains(@id, ‘type_2_’)]",

Without url page is impossibile to help you.

Every elment have multiple xpath, some xpath are easier to find what you chose you use ID that changes but surely there will be other xpath that are based on other more stable elements.

Nevertheless, if this does not bother you, please see what is in the archive.
I saved the page and packed in rar canstock.rar - Google Drive

I downloaded the file now i create for you a macro code, wait some minutes

In the saved page i can not run a macro but i create for you a macro code and you can try it in online page.

These are the alternatives xpath available, latest xpath have not dynamic element and is more easy to detect.

xpath

none of the methods I found to scroll down this page worked … This prevented me from using xpath

This is the macro code to click is based on fixed xpath

I can not try online because i have no access to online page but if do not work the code try to increment this value [2] to [3] or [4] for every loop try to increment but i think this value can be fixed to [2] (I can not try online the macro code).

{
  "Name": "Element",
  "CreationDate": "2020-3-16",
  "Commands": [
    {
      "Command": "click",
      "Target": "xpath=(//label[contains(.,'Illustration')])[2]",
      "Value": ""
    }
  ]
}

This is the image of ui vision the detect element

element

I wrote that this will not work. I have already tried. Only one button with an illustration is visible on the page, and swiping down does not work

Thank you. I’m trying to make another account now. I hope it will be approved within a day. Then I can provide URL access.
I really appreciate what you do. I hope that everything works out.

In the saved page I see an auto refresh this can be the problem, because saved page load always and refresh.

If the page continue to refresh ui vision can not work, need a fully loaded page url.

I’m sure refresh can be disabled, this will help

If you disable autorefresh my macro code working well.