0

I need to use a javascript user script (through GreasMonkey/TamperMonkey extensions or else) to change the default values of some input text boxes inside some iframe that is created dynamically in a web service.

Using the console window of chrome when the javascript context is at top I can access to the required element through something like this:

document.getElementsByTagName('iframe')[1].contentDocument.getElementsByTagName('iframe')[1].contentDocument.getElementById('txtCode1')

So now what can I do to have a generalized Greasemonkey code to access the input texts (that are dynamically created, not on the load of the page) and change the default values to the desired ones?

mhmdghfr
  • 41
  • 2
  • 2
  • 9
  • [postMessage](https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage) – Lain Jul 13 '20 at 11:56
  • The question is too general/broad. Use MutationObserver to detect iframes then use MutationObserver inside the iframe (or just wait via setTimeout) for the inputs to appear. – wOxxOm Jul 13 '20 at 15:53

0 Answers0