What works well is to use XClick to click on “Choose File” and then XType to enter the file name:
{
"Name": "file upload",
"CreationDate": "2023-3-25",
"Commands": [
{
"Command": "open",
"Target": "https://ocr.space/",
"Value": "",
"Description": ""
},
{
"Command": "XClick",
"Target": "choose_dpi_168.png",
"Value": "",
"Targets": [
"id=imageFile",
"xpath=//*[@id=\"imageFile\"]",
"xpath=//input[@id='imageFile']",
"xpath=//div[2]/input",
"css=#imageFile"
],
"Description": ""
},
{
"Command": "XType",
"Target": "C:\\test\\roadsign1.jpg",
"Value": "",
"Description": ""
},
{
"Command": "XType",
"Target": "${KEY_ENTER}",
"Value": "",
"Description": ""
},
{
"Command": "click",
"Target": "id=engine5",
"Value": "",
"Targets": [
"id=engine5",
"name=OCREngine",
"xpath=//*[@id=\"engine5\"]",
"xpath=//input[@id='engine5']",
"xpath=//div[4]/label/input",
"css=#engine5"
],
"Description": ""
},
{
"Command": "click",
"Target": "linkText=Start OCR!",
"Value": "",
"Targets": [
"linkText=Start OCR!",
"xpath=//*[@id=\"btnStartOCR\"]/a",
"xpath=//a[@onclick='StartOCR()']",
"xpath=//div[13]/div[2]/a",
"css=#btnStartOCR > a"
],
"Description": ""
}
]
}
See also this older post.
PS: Instead of using XClick | imageOfButton you can also use the XClickText | Choose
command.