0

I want know if its possible to click in a button inside my iframe.

I want click in "Click me!" and select "Geração" button from my iframe. It's possible do it?

I'm trying that:

    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
    </head>
    <body>
        
        <button id="btn1" onclick="clickButton()">
            Click Me!
        </button>
        <iframe src="https://bhissdigital.pbh.gov.br/nfse/" width="1000" height="500"></iframe>
        <script type="text/javascript">
    
     // Simulate click function
     function clickButton() {
       parent.document.getElementById('menu:bt_emissao').click(); 
           }
    
        </script>
    
    
    </body>
    </html>

img example

v.k.
  • 2,826
  • 2
  • 20
  • 29
dumb163
  • 21
  • 5
  • 1
    Only if the iframed page and the parent page are of the same origin. – Terry Oct 21 '22 at 16:40
  • This would be a huge security issue otherwise. Suppose you just rendered an iframe for my banking website and then clicked around in there via js. – CollinD Oct 21 '22 at 17:10

0 Answers0