Multiple file upload from local drive to web portal

Win 10 PC
FileAccess XModule Installed (v1.0.12)
DesktopAutomation XModule Installed (v1.0.42)
Screen Capture XModule Installed (v1.3.6)

I am trying to upload multiple files from my local drive to a web portal.

The recorder works, but the name/s of the files change from week to week.

I can use a wildcard or possibly do read from CSV, however, I am trying to avoid having to manage another list or have to add/delete from the script when things change.

So, I’m trying to upload the first file, then select that file and use Xtype Key_Down, so on and so forth, wrapped into possibly a Do…While loop to upload the remaining files.

It succeeds up until the xType Key_Down command. The logs show the command completes however in the upload window the next file down is not selected.

{
“Name”: “File Upload”,
“CreationDate”: “2021-10-25”,
“Commands”: [
{
“Command”: “bringBrowserToForeground”,
“Target”: “”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “open”,
“Target”: “Website”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “click”,
“Target”: “id=files”,
“Value”: “”,
“Targets”: [
“id=files”,
“name=files”,
“xpath=//[@id=“files”]",
“xpath=//input[@id=‘files’]”,
“xpath=//input”,
“css=#files”
],
“Description”: “”
},
{
“Command”: “XClick”,
“Target”: “Cdrive_dpi_96.png”,
“Value”: “”,
“Targets”: [
“id=files”,
“name=files”,
"xpath=//
[@id=“files”]”,
“xpath=//input[@id=‘files’]”,
“xpath=//input”,
“css=#files”
],
“Description”: “”
},
{
“Command”: “XClick”,
“Target”: “Folder_dpi_96.png”,
“Value”: “#doubleclick”,
“Targets”: [
“id=files”,
“name=files”,
“xpath=//[@id=“files”]",
“xpath=//input[@id=‘files’]”,
“xpath=//input”,
“css=#files”
],
“Description”: “”
},
{
“Command”: “XClickRelative”,
“Target”: “FirstFileUpload_dpi_96.png”,
“Value”: “#doubleclick”,
“Description”: “”
},
{
“Command”: “pause”,
“Target”: “5000”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “click”,
“Target”: “id=files”,
“Value”: “”,
“Targets”: [
“id=files”,
“name=files”,
"xpath=//
[@id=“files”]”,
“xpath=//input[@id=‘files’]”,
“xpath=//input”,
“css=#files”
],
“Description”: “”
},
{
“Command”: “XClickRelative”,
“Target”: “FirstFileUpload_dpi_96.png”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “XType”,
“Target”: “${KEY_DOWN}”,
“Value”: “”,
“Description”: “”
}

Uploading all files in a folder should be no problem. → can you add a screencast video of the issue?

Hmmm, it would be tough to add screencast video as I work with sensitive data.

I was able to get the Xtype Key_Down command to work with the original script I submitted. Not sure what the issue was, as the only change was restarting Chrome browser and IDE.

I now have a working solution and would appreciate a look over, as I’ve only been at this for about a week. Any tips or alternative ways to complete would be appreciated.

I use a PS script to get total files and send them to the ${!clipboard} for the While loop.

Thanks!

Win 10 PC
FileAccess XModule Installed (v1.0.12)
DesktopAutomation XModule Installed (v1.0.42)
Screen Capture XModule Installed (v1.3.6)
Chrome Version 95.0.4638.54 (Official Build) (64-bit)

{
“Name”: “File Upload”,
“CreationDate”: “2021-10-28”,
“Commands”: [
{
“Command”: “XRunAndWait”,
“Target”: “powershell.exe”,
“Value”: "-executionpolicy bypass -File “C:\GetFileCount.ps1"”,
“Description”: “”
},
{
“Command”: “echo”,
“Target”: “${!xrun_exitcode}”,
“Value”: “blue”,
“Description”: “”
},
{
“Command”: “echo”,
“Target”: “${!clipboard}”,
“Value”: “green”,
“Description”: “”
},
{
“Command”: “bringBrowserToForeground”,
“Target”: “”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “executeScript_Sandbox”,
“Target”: “return Number (${!clipboard})”,
“Value”: “totalFiles”,
“Description”: “”
},
{
“Command”: “executeScript_Sandbox”,
“Target”: “return Number (1)”,
“Value”: “currentFile”,
“Description”: “”
},
{
“Command”: “open”,
“Target”: “Website”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “while_v2”,
“Target”: “${currentFile} <= ${totalFiles}”,
“Value”: “currentFile”,
“Description”: “”
},
{
“Command”: “click”,
“Target”: “id=files”,
“Value”: “”,
“Targets”: [
“id=files”,
“name=files”,
“xpath=//[@id=“files”]",
“xpath=//input[@id=‘files’]”,
“xpath=//input”,
“css=#files”
],
“Description”: “”
},
{
“Command”: “XClick”,
“Target”: “Cdrive_dpi_96.png”,
“Value”: “”,
“Targets”: [
“id=files”,
“name=files”,
"xpath=//
[@id=“files”]”,
“xpath=//input[@id=‘files’]”,
“xpath=//input”,
“css=#files”
],
“Description”: “”
},
{
“Command”: “XClick”,
“Target”: “Folder_dpi_96.png”,
“Value”: “#doubleclick”,
“Targets”: [
“id=files”,
“name=files”,
“xpath=//*[@id=“files”]”,
“xpath=//input[@id=‘files’]”,
“xpath=//input”,
“css=#files”
],
“Description”: “”
},
{
“Command”: “XClickRelative”,
“Target”: “FirstFileUpload_dpi_96.png”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “if_v2”,
“Target”: “${currentFile} > 1”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “executeScript”,
“Target”: “return ${currentFile} - 1”,
“Value”: “Key_Down_Count”,
“Description”: “”
},
{
“Command”: “times”,
“Target”: “${Key_Down_Count}”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “XType”,
“Target”: "${KEY_DOWN} ",
“Value”: “”,
“Description”: “”
},
{
“Command”: “end”,
“Target”: “”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “end”,
“Target”: “”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “XClick”,
“Target”: “OpenButton_dpi_96.png”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “pause”,
“Target”: “30000”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “executeScript”,
“Target”: “return ${currentFile} + 1”,
“Value”: “currentFile”,
“Description”: “”
},
{
“Command”: “end”,
“Target”: “”,
“Value”: “currentFile”,
“Description”: “”
}

Great to hear that it works. The macro script looks good to me!

Thanks! Really appreciate your time!