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

selenium-ide
file-upload

#1

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"}

Macro stops at file selection window on chrome(windows 7)
#2

Yeah, we see the same issue since a few days. Now Chrome is at 72.0.3626.96 and the problem is still there. Normally Kantu (just like all other tools you mentioned) would use Chrome’s debugging API to perform file uploads. But since the latest Chrome updates Kantu stops at the “Kantu… is debugging this browser” message.

cdbaby

But the solution is easy: Until the Chrome team allows automated file uploads again via its extension API you can use xtype to automate file uploads:

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

The xtype solution has the great advantage that it works for file uploads in Firefox, too :smiley:

Demo macro:

{
  "Name": "file-upload-with-xtype",
  "CreationDate": "2019-2-9",
  "Commands": [
    {
      "Command": "open",
      "Target": "https://ocr.space/",
      "Value": ""
    },
    {
      "Command": "click",
      "Target": "id=imageFile",
      "Value": ""
    },
    {
      "Command": "XType",
      "Target": "f:\\testcases\\data\\up1.png",
      "Value": ""
    },
    {
      "Command": "XType",
      "Target": "${KEY_ENTER}",
      "Value": ""
    },
    {
      "Command": "click",
      "Target": "link=Start OCR!",
      "Value": ""
    }
  ]
}

Is firefox file upload through file input is not avaialble yet?
"kantu browser automation" is debugging this browser
#3

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


#4

@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:


#5

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: