Writing test for an iFrame generated when a button is clicked. The iFrame name and id are similar but generated dynamically. I have used "switchToiFrame" successfully before.
<div class="bbbb-frame-container" style="height: 400px; width: 665px; margin-top: -200px; margin-left: -332.5px;">
<div class="user-support-frame-close-container" style="display: block;">
<div class="user-support-frame-close">Close</div>
</div>
<iframe id="poplock_default9636_priv" frameborder="0" name="poplock_default9636_priv" src="blah.blaag.com">
<!DOCTYPE html>
.....................
The poplock_defaultNNNN_priv is the dynamically generated iFrame that I would like to switch to..
First, find an iframe with one of the find methods. If it's the only iframe on the page (or the first one) use the find() method
. If it's not, you'll have to use findAll()
and rely on the order (since there's no distinct attribute you could search for).
Once you find your iframe, you can use getAttribute
to get its name and then use switchToIframe
to... well, switch to the iframe.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With