xClick - How to select the first button?

Hello !

I need to monthly download a report from this page and this is always the first button " Télécharger le fichier modèle V2" that I need to downlaod but my problem is that the button can be 1 month at the position and then at the second position …

So maybee am wrong but I trying to use xClick to do this, but the task stop and it seems it don’t know which button to click and I don’t know how to select the first button (1.00 #1) ?
Let me know if I’m doing it in the wrong way :slight_smile:

Thanks for your help !

Probably something like:
Click
//button[text()='Télécharger le fichier modèle V2'][1] First row
//button[text()='Télécharger le fichier modèle V2'][2] Second row, etc.

If you can post the link we can look at the selectors for that button

Hello,

I can’t give you access as is is password protected page …
Maybee this can help ?

Without the page URL I can’t help further but you can use an extension such as ChroPath to find the selectors for that button

Have you tried this?

XClick | image of the button

It seems are already testing with using an image, or?

Hi, when using ChroPatch, I have a strange message and not the xpath :slight_smile:

Hi,

Yes this is what I’m doing xClick, but when executing xClick, it adds some strange numbers (N°1 to number 5) on the page as you can see and nothing happen … I think xClick don’t know which one to click, but I don’t know what to do then ?

# parameter explained:

If there are a few images that match the input image, normally the best match is selected. But you can force UI.Vision to select another match at a certain position with #. So to click the 3rd matching image (counted from top left to bottom right) use image#3 or image@conf.Level#3.

The strange thing is that if I look at the red box, the computer vision finds exactly the button that you want to click, or?

But you say the button is still not pressed?

As a test, does the DemoXClick macro work? (it ships with UIVision)

To solve this hard case i use my method, I search in the page an anchor (usually the button of the element to find) and I make Xclick on the anchor to set focus after with KEY_TAB I move the focus in my element to find and when focus is over the element to find I click KEY_ENTER or another combination to download the element in focus (right mouse button and save or similar).

The strange thing is that if I look at the red box, the computer vision finds exactly the button that you want to click, or?

Yes it does.

But you say the button is still not pressed?

Yes, the button is not pressed, and the task stop here.

As a test, does the DemoXClick macro work? (it ships with UIVision)

I deleted it by mistake. But I found this here : https://github.com/A9T9/Kantu/tree/master/test/demomacros/xmodules
After downloading I have an error in the script because a link url doesn’t seems to be good inside the script.

I do not suggest to use image recognition because it’s very easy do not work because can be affected from the windows resolution and responsive site that change and image recognition require always same resolution and same screen size.

KEY_TAB is universal and working always in same mode with all resoluition.

I also try to add a simple “Click” command
With target : linkText=Télécharger le fichier modèle V2

And it works, it click on the first link …no matter the position of the button on the page it always clicks on the first link, what do you think?

But is this a good solution ?

More simple is the macro code and more stable will be, click is the best solution.

If you need to click another link in the same page you can use the POS=N to choice prefered link

Position support in link text locator

With CLICK link=Download@POS=3 you instruct the IDE to use the n-th (here n=3) occurrence of a locator. This is useful, for example, if a have a website with many download links, and you want to click the n-th once. POS is only supported with the “normal text” locator link=… but not with XPATH and CSS selectors.

Ok, thanks for your answer will try and see :slight_smile: