Can't automate webpage with iframes
This article provides a workaround to an issue where you can't automate a webpage if a web element is inside a cross-domain iframe in Microsoft Power Automate.
Applies to: Power Automate
Original KB number: 4599053
Web automation actions can't interact with a web element that is inside a cross-domain iframe. The element may be captured successfully during authoring. However, during runtime you receive an error message that resembles the following message:
Click link on web page failed.
To verify that the web element is indeed inside a cross-domain iframe, follow these steps:
- Open the web browser and locate the element.
- Press F12 to open the DOM Explorer window of the browser.
- Select the element through the DOM Explorer.
- Within the DOM Explorer window, locate its parent iframe element.
- Check the domain that hosts the iframe element.
The domain should be different than webpage's domain.
Open the source webpage of the iframe element on a new tab or a new browser window and continue the automation on the new webpage.
This procedure can be automated by capturing the embedded webpage's URL using the "Get details of element on web page" action. The attribute's value to be captured is the
src attribute of the iframe element.
Then, use the "Launch new browser" or "Create new tab" action to open the new webpage.
There are cases where this workaround might not apply. For example, if the actions to be performed within the iframe window affect other fields of the parent webpage.