Link to home
Start Free TrialLog in
Avatar of thenelson

asked on

Get ID for button in iframe and click it via VBA

I am trying to programmatically click a button of a popup iframe. Here is the code for the iframe:
<iframe width="100%" id="iMaintenancePopup" src="../oa/Common/maintenancePopup.aspx" frameborder="0" scrolling="no" style="height: 723px;"></iframe>

Open in new window

Here is the screenshot for the popup iframe:User generated imageHow do I get the ID for the button that states: "I acknowledge this message" and how do I click it using VBA?
Avatar of Joe Howard
Joe Howard
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of thenelson


In IE, I right-clicked on the button and selected "Inspect Element" but the button did not display in the DOM Explorer (or any of the other tabs).
Try in Chrome or Firefox.
Ok, so I found that the button ID is "btnAcknowledge".

does not work, The automation does not see the button because it is in an iframe.
also does not work.

I am looking for the correct syntax for referencing the button in an iframe.
Or some other way to close the popup iframe if it pops up.
I found the correct code to click the button: