JavaScript Autofill Issues

Viewed 197

I am attempting to create a simple chrome extension autofill for Stripe Checkout pages. Chromes default autofill functions like expected however when trying to use my extensions autofill code to input values into the forms like so

document.getElementById("ID").value = "value"

the value is input initially but will be automatically removed for any number of reasons, like clicking outside of the input or anywhere else on the page will have the value of the input removed. I have tried a few different things like firing all of the necessary events for keyboard input like keyup,keydown,input, change ect and I can not get the value to stick.

I believe that stripe is using some JS to check whether or not the events sent to the input were trusted and if not it is removing the values. for this reason I have attempted to use Chromes Debugger API to send commands directly to the browser. I have found a command that seems like it will work for what I need. The "Input.dispatchKeyEvent" command appears to be what I need but I do not see a way to specify what element the keys are being sent to.

chrome.debugger.sendCommand({tabId:TAB_ID}, "Input.dispatchKeyEvent",{type:"char"})

How Can I Prevent The Values From Being Removed? Is There A Way To Send trusted key Events To A Specific Element On The Page Using The Debugger?

An Example Of A Stripe Checkout Page Can Be Found Here Click Pay Now To Be Brought To A Testing Page https://demo.wpsimplepay.com/stripe-checkout/

Command Docs https://chromedevtools.github.io/devtools-protocol/1-3/Input/#method-dispatchKeyEvent

1 Answers

I don't think is something you'll be able to do, as I'd expect Stripe would want to avoid auto-filling of card details from anything other than the browser or a trusted application.

Related