'How to block the file chooser in Firefox?

I'm developing an application that uses Selenium for automation of a certain process that involves file upload. There is a button on that website that executes some ajax which loads in the file input element, but also tries to open file chooser for some reason.

In Chrome it works fine - the file chooser is blocked (message from the console: File chooser dialog can only be shown with a user activation.). The problem is that I can't block it in Firefox. I looked through about:config and found nothing useful.

So how do I block it?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source