file chooser dialog can only be shown with a user activation

Good Day,

I’m work in a bot that interact with a web page. I need do click in an element that open the windows file explorer and I load file .zip.

I’m send javascript from Pega but It don’t execute the event click in the element. I did test from console and the script execute rigth. When I send script from Pega it returns the following “file chooser dialog can only be shown with a user activation”. Please, you can help me.

@NiyiredC I have always found that using SendKeys to trigger those controls is the easiest. I do not have a JavaScript that I am aware of that works to trigger them since these types of controls generally prevent scripts from triggering them. Here is an example of SendKeys.

Project52.zip (177 KB)

Hello @ThomasSasnett,

Thank a lot for you answer, I reviewed your project, I see that you send “keystroke”,but I dont have this option in my version. My version is 8.0.2025.0.

exist other solution or how can I found “SENDKEYS” in my version?.

@NiyiredC You are correct. I don’t believe that was available until more recently. You should consider upgrading to a later version (I would suggest the latest build of 19.1).

@ThomasSasnett But the SendKeys won’t work when the BOT is running on a Windows VM and it is locked. It needs the Windows VM or the session to be live on screen or the VM to be unlocked. Is there any other alternative for this scenario?

@SujithN0 I do not believe so. These dialogs need to be triggered by user action and probably can’t be triggered from a locked machine.

Hello ThomasSasnett, Please is there any solution for above issue ? We face the very same situation currently, after microsoft stopped supporting Internet Explorer, we had to move all our robot solutions to Chrome, we run 3 unattended bots in 3 different VMs, where currently we need to stay logged in because the only option is to use “sendkeys” , after we disconnect from VMs, all robots stop working, these robots do work compared to 2FTE everyday.

Thank you very much

@DavidT SendKeys will not work on a locked machine likely forever. The resolution for this problem is to ensure that if you have an unattended process, you run that process on a VM that is unlocked and remains so during the duration of the automation. If that is not possible, then you can run the automation as an attended automation and have a user preventing the screen from being locked while it is running.

@ThomasSasnett Our ask is to run it as an unattended BOT on a VM which will perform these actions. We have observed that the SendKeys wont work as the VM will eventually get locked due to organization Infosec policies, Is there any other alternative?

@SujithN0 Not that I am aware. If you are automating a task as a user and that task cannot be done if the workstation is locked, then you can run that task as an attended automation triggered by a user or setup your unattended VMs to remain unlocked (or run some process on them to keep them from locking; assuming you’d get permission to do so).