Home > Software engineering >  Android Espresso webClick() not working on input tag
Android Espresso webClick() not working on input tag

Time:04-29

My problem is that when I have a <input type='file' id='input1'> and I try to click on it using webClick(), nothing happens.

CodePudding user response:

I'm posting this question and answer because I spent so many days trying to figure out what the issue was, and I hope I can save time for the next person.

The answer here is that it is likely that for security reasons, you can't have an automated click on an input tag (or at the very least that seems to be the problem with our code). My colleague managed to find an error using adb logcat that looked something like this:
chromium: [INFO:CONSOLE(164)] "File chooser dialog can only be shown with a user activation.", source: (164)

Using UIAutomator instead of Espresso seemed to fix this issue. Best of luck!

  • Related