Chrome update disabled the file upload feature? {"code":-32000,"message":"Not allowed"}

This is since the Chrome 72.0.3626.81 update. It seems to me all web automation tools are affected. When I search for the error, I find similar error reports in the Selenium IDE ticket system, the Katalon forum and the iMacros forum :roll_eyes:

type on id=imagepp with value c:\testdata\passport1.png Failed:

{"code":-32000,"message":"Not allowed"}

Update June 6, 2019: This issue first appeared in Chrome V71. Native file upload continues to be disabled in Chrome V75 (“-32000” error message). The related Chromium ticket DOM.setFileInputFiles returning error “Not allowed” is still open. Normally the RPA software would use Chrome’s debugging API to perform file uploads. But since the V71 Chrome update Kantu (and all other similar tools) stop at the “(extension) …is debugging this browser” message and display an error like {“code”:-32000,”message”:”Not allowed”}
cdbaby

:point_right: :partying_face: Update April 5, 2020: File upload with Selenium IDE commands works again but (new!) only if “Allow access to File URLs” is enabled. This video shows the file upload:

RPA File Upload Workaround for Firefox

With the UI.Vision RPA Selenium IDE the solution is to use xtype to automate file uploads:

  • click| id=imageFile (open upload file picker)
  • xtype | f:\\testcases\\data\\up1.png
  • xtype | ${KEY_ENTER}

Screencast of the file upload in action:

Demo macro for Chrome:

 {
  "Name": "1upload",
  "CreationDate": "2019-5-2",
  "Commands": [
    {
      "Command": "open",
      "Target": "https://cgi-lib.berkeley.edu/ex/fup.html",
      "Value": ""
    },
    {
      "Command": "XClick",
      "Target": "name=upfile",
      "Value": ""
    },
    {
      "Command": "XType",
      "Target": "C:\\1tmp\\1test.txt",
      "Value": ""
    },
    {
      "Command": "XType",
      "Target": "${KEY_ENTER}",
      "Value": ""
    },
    {
      "Command": "clickAndWait",
      "Target": "xpath=/html/body/form/input[3]",
      "Value": ""
    }
  ]
}

:fire::fox_face: Test macro for Firefox

Here, XType | ${KEY_ENTER} does not work (we are not sure yet why). But the workaround is easy: You can replace the ENTER keystroke with an XClick on the “Open” button using desktop automation and XDesktopAutomation | true before the XClick command. The XClick image used is:

1test_dpi_96

{
  "Name": "1upload-firefox",
  "CreationDate": "2019-5-2",
  "Commands": [
    {
      "Command": "open",
      "Target": "https://cgi-lib.berkeley.edu/ex/fup.html",
      "Value": ""
    },
    {
      "Command": "XClick",
      "Target": "name=upfile",
      "Value": ""
    },
    {
      "Command": "XType",
      "Target": "C:\\1tmp\\1test.txt",
      "Value": ""
    },
    {
      "Command": "comment",
      "Target": "XType // ${KEY_ENTER}",
      "Value": ""
    },
    {
      "Command": "XDesktopAutomation",
      "Target": "true",
      "Value": ""
    },
    {
      "Command": "XClick",
      "Target": "1test_dpi_96.png@0.6",
      "Value": ""
    },
    {
      "Command": "clickAndWait",
      "Target": "xpath=/html/body/form/input[3]",
      "Value": ""
    }
  ]
}
3 Likes

does this xtype solution work on mac as well? (Since there is no field for typing the location of the file really)

1 Like

@ronny911 - good point, on Mac the macro needs to be slightly modified:

Instead of sending the file path with XType , we need to select the file from the dialog. For this we can use the new desktop automation feature of Kantu. We switch the Kantu eyes to desktop mode with XDesktopAutomation | true and then use either XClick | image of file name or (recommended) XClick |ocr=file name. This does a text search for the file name on the screen, finds it and then clicks it.

The remaining part of the macro is the same. We use XType to send ENTER, and all is done.

I tested that this works and made a short screencast:

Hi

For which version of Kantu and Firefox does it work? Because of version Kantu 4.0.1 and Firefix 66.0 follow code doesn’t upload files:

{
      "Command": "XType",
      "Target": "${KEY_ENTER}",
      "Value": ""
    }
```:fearful:

hi, i have same problem with upload function… how long it take to fix this? xtype is not solution for me because it just limited for 25 command, meanwhile i have problem to upgrade this. And then sometimes this command in example :

{
“Command”: “click”,
“Target”: “id=imageFile”,
“Value”: “”
},

does’nt show openfile dialog box, so cant use xtype for give the name of file or enter. and it starting failure chain while macro running

please fix this upload function like before without xtype.

Hi Team,

1st point:
as the 1st screenshot shows, i followed the code above, while still got the error,
it just stops after showing the openfile dialog box.
while the .png file with correct directory is there(as the 2nd screenshot shows).

2nd point:
while what i input in the code is “f:\testcases\data\up1.png”, the error log prompt as “f: estcases\data\up1.png”
apparently the “\t” is omitted, any insights on this issue?

Environment:
Windows 7 64 bit;
Chrome:
Version 73.0.3683.86 (Official Build) (64-bit);
Kantu Browser Automation Extension: 4.1.6

also, the XModules, i’d installed as the screenshot shows with the latest version.
can any one tell me what’s wrong here? Thanks!

file

This is a bug in Chrome, not Kantu. The Chrome team told us this will be fixed with V74 in a few weeks.

This a bug in Kantu. It thinks \t is an escape sequence. This will be fixed soon. The current workaround is to avoid path names that start with “t”.

how about my 1st point?

thanks for your specific reply.

For the first point, I think it is related to the “\t” issue. => If you use a path without"…\t…" in it, does it work then?

hi, it works after the “\t” omitted, while there’s a new question here in this scenario:

(btw, i’ve updated into the latest version of Kantu: 4.1.12, others:
Environment:
Windows 7 64 bit;
Chrome:
Version 73.0.3683.103 (Official Build) (64-bit) (updated);

as attached, for testing purpose, the file is not existed in the hard drive, while is in the macro code, so the question is: how to ignore the “local File not found(via address link)” error message, basically simulating: click the “OK” button-> “Cancel” button as in the attached screenshot, then move on to the next steps?

thanks.

Chrome 74 is out, unfortunately i’m not seeing the old method of file uploading without XType working. Can anyone else confirm what i’m seeing as well?

Yes. The regular type | name=upfile | C:\\fakepath\\test.txt upload method is still not working. It is the same issue with the classic Selenium IDE and any other tool i tested. But the related Chromium ticket is closed: 928255 - chromium - An open-source project to help move the web forward. - Monorail

So I am not sure what this means?

You can simulate a click on the “Cancel” button in three different ways:

(1) In Chrome

  • Use XType | ${KEY_TABS} to move the selection to from “OK” to “Cancel”, then simulate Enter.

(2) In Chrome and Firefox

Use desktop automation and then find and click the “Cancel” button

  • XDesktopAutomation | true
  • XClick | (image of cancel button)

(3) In Chrome and Firefox

Use desktop automation and plus screen scraping (OCR). Then no input image is needed.

  • XDesktopAutomation | true
  • XClick | ocr=Cancel

And if you need to make decisions inside your macro, then use one of the flow control commands.

1 Like

The regular type | name=upfile | C:\\fakepath\\test.txt upload method is still not working.

Update 2021: File upload automation continues to be working fine. But meanwhile Chrome changed its behavior a bit, and you need to enable “Allow access to file URLs” for the RPA extension to allow automated file uploads.

Would like to bring attention back to this
Condition:
UIVision Version 8.1.23
Chrome - Version 106.0.5249.119 (Official Build) (64-bit)
Win 10
RPA extension to allow automated file uploads - Done

The script is not working.

Hello, this post is to confirm that file upload automation works fine with Ui.Vision - but please note that there is an important setting:

:point_right: You need to allow access to File URLs to upload files or automate local web pages

In order to be able to or automate HTML files stored on the local computer (e.g. file:///...), you need to tell Chrome to allow access to file URLs for the Ui.Vision open-source extension:

  1. In the Chrome menu, go to More tools - Extensions and find Ui.Vision in the list of extensions
  2. Click the Details button
  3. Make sure “Allow access to file URLs” is checked

This video shows how to do file upload automation: