How to download several documents

Hi guys,

Im new using UI.Vision, and im still learning the basics, hope you guys can help me to solve this problem!

So… I want my macro to download the 3 documents that im selecting. But, once I select those 3 documents I have to click on “Descargar facturas seleccionadas”, that basically means… download each document selected, by doing that, it will open a new window where you have to confirm the download, and after that I would like to close the new window to go back to the original one… But it is not working…

Some context:

image

(Selecting the 3 documents that I want to download)

(The new window that confirms your download)

(My macro doesnt even open the new window, for now it only selects the documents)

Here is my code:

{
“Name”: “test4”,
“CreationDate”: “2023-1-31”,
“Commands”: [
{
“Command”: “type”,
“Target”: “name=reprocesar”,
“Value”: “3609850”,
“Targets”: [
“name=reprocesar”,
“xpath=//[@id="tabla"]/tbody/tr/td/input",
“xpath=//input[@name=‘reprocesar’]”,
“xpath=//div/div/table/tbody/tr/td/input”,
“css=#tabla > tbody > tr:nth-child(1) > td:nth-child(1) > input:nth-child(1)”
],
“Description”: “”
},
{
“Command”: “click”,
“Target”: “name=reprocesar”,
“Value”: “”,
“Targets”: [
“name=reprocesar”,
"xpath=//
[@id="tabla"]/tbody/tr/td/input”,
“xpath=//input[@name=‘reprocesar’]”,
“xpath=//div/div/table/tbody/tr/td/input”,
“css=#tabla > tbody > tr:nth-child(1) > td:nth-child(1) > input:nth-child(1)”
],
“Description”: “”
},
{
“Command”: “type”,
“Target”: “xpath=//[@id="tabla"]/tbody/tr[2]/td/input",
“Value”: “3609851”,
“Targets”: [
“name=reprocesar”,
"xpath=//
[@id="tabla"]/tbody/tr[2]/td/input”,
“xpath=//input[@name=‘reprocesar’ and @value=‘3609851’]”,
“xpath=//div/div/table/tbody/tr[2]/td/input”,
“css=#tabla > tbody > tr:nth-child(2) > td:nth-child(1) > input:nth-child(1)”
],
“Description”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//[@id="tabla"]/tbody/tr[2]/td/input",
“Value”: “”,
“Targets”: [
“name=reprocesar”,
"xpath=//
[@id="tabla"]/tbody/tr[2]/td/input”,
“xpath=//input[@name=‘reprocesar’ and @value=‘3609851’]”,
“xpath=//div/div/table/tbody/tr[2]/td/input”,
“css=#tabla > tbody > tr:nth-child(2) > td:nth-child(1) > input:nth-child(1)”
],
“Description”: “”
},
{
“Command”: “type”,
“Target”: “xpath=//[@id="tabla"]/tbody/tr[3]/td/input",
“Value”: “3573564”,
“Targets”: [
“name=reprocesar”,
"xpath=//
[@id="tabla"]/tbody/tr[3]/td/input”,
“xpath=//input[@name=‘reprocesar’ and @value=‘3573564’]”,
“xpath=//div/div/table/tbody/tr[3]/td/input”,
“css=#tabla > tbody > tr:nth-child(3) > td:nth-child(1) > input:nth-child(1)”
],
“Description”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//[@id="tabla"]/tbody/tr[3]/td/input",
“Value”: “”,
“Targets”: [
“name=reprocesar”,
"xpath=//
[@id="tabla"]/tbody/tr[3]/td/input”,
“xpath=//input[@name=‘reprocesar’ and @value=‘3573564’]”,
“xpath=//div/div/table/tbody/tr[3]/td/input”,
“css=#tabla > tbody > tr:nth-child(3) > td:nth-child(1) > input:nth-child(1)”
],
“Description”: “”
},
{
“Command”: “click”,
“Target”: “linkText=Descargar facturas seleccionadas”,
“Value”: “”,
“Targets”: [
“linkText=Descargar facturas seleccionadas”,
“xpath=//*[@id="tablaINI"]/tbody/tr/td/table/tbody/tr/td/table/tbody/tr[2]/td/a”,
“xpath=//a[@onclick=‘irDescargaMasiva()’]”,
“xpath=//tr[2]/td/a”,
“css=#tablaINI > tbody > tr > td > table > tbody > tr > td > table:nth-child(1) > tbody > tr:nth-child(2) > td > a:nth-child(1)”
],
“Description”: “”
},
{
“Command”: “selectWindow”,
“Target”: “title=e-Factura® CNMC”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “click”,
“Target”: “name=btnDescargar”,
“Value”: “”,
“Targets”: [
“name=btnDescargar”,
“xpath=/html/body/form/center/center/p/input”,
“xpath=//input[@name=‘btnDescargar’]”,
“xpath=//p/input”,
“css=body > form > center > center > p > input:nth-child(1)”
],
“Description”: “”
}
]
}

all help is welcome!!!

It can not find the locator for the button on the popup. => Try with XClick+Image or XClickText |descargar

Maybe you even have to use desktop automation for this click, I am not sure.