I am developing an application that requires to auto-fill logins in other installed apps and chrome. I am able to successfully auto-fill logins in other installed apps using AccessibilityService but could not get it working on Chrome browser. I am able to identify the username and password AccessibilityNodeInfo but I am not able to paste the content into it.
This is how I am trying, I am copying the content to be filled into Clipboard and then pasting the content into these username and password fields using AccessibilityNodeInfo.ACTION_PASTE. This technique works well for other installed apps but it fails to paste in Chrome. I am not able to find any relevant posts online except this one - link, but there is no clear solution in it. Also I am not able to find anything documented on developer site too. Should I be injecting javascript code to paste my content? If so can you please give me an example? I have done that using WebView previously but in this case I don't have reference to the view.
Any help on this will be greatly appreciated.
You can run javascript to accomplish this by executing something like the following:
document.getElementById("username").val = "username";
however I doubt if you can just run arbitary js in the chrome app as an outside app.