Testing in iframes
Mabl makes testing iframes as easy as testing any other part of your app. Read below to learn more about the best ways to test in iframes.
Switching context to iframes
To interact with a regular click, click into the iframe as you normally would interact with any other element on your website. The mabl Trainer will automatically recognize the interaction with the iframe and add a "switched context to iframe" step right before the action you recorded. When you interact with the rest of your website, mabl will display a "switched context to root frame" message so you can be sure mabl is interacting with the correct elements.
Using XPath and CSS selectors in iframes
If you're using custom finds with XPath or CSS selectors, you need to be sure that mabl is looking in the correct frame. Before recording the custom find, be sure to click into the iframe you'd like to test. This will create a "switched context to iframe" step which tells mabl which frame to test. Once you've done this, just record your XPath or CSS selector as you normally would. Remember to switch context back to the rest of the website if you'd like to change which frame you're testing in.
Nested iframes support
Interacting with nested iframes is mostly the same as interacting with any other iframe with the mabl Trainer. You'll see an additional "switched context to iframe" message for each extra iframe you're interacting with. There's no need to treat these iframes any differently than other iframes within your app.
Updated 4 months ago