Selenium Python - working with dynamic iframe popups

Viewed 12

I will try to explain this best i can. I am trying to automatically enter data onto a web page. This is the basic representation of it:

<html>
    <head>
        <body>
            <div id="container">
                <div id="'header"></div>
                <div id="content"></div>
                <div id="footer"></div>
            </div>
            <div id="control_window_11" class="simple_window" style="margin: 0px; position: absolute; z-index: 10008; display: none;"><div class="modalReportWindowClose"></div></div>
            <iframe undefined="position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);display:none" src="javascript:void(0);" frameborder="0" style="position: absolute; display: none;"></iframe>
        </body>
    </head>
</html>

`<div id="control_window_10"></div> and <iframe></iframe>` 

are both generated dynamically when i click save. After saving, the popup will go away and <div id="control_window_10" will be changed too: <div id="control_window_11". the issue appears after the first successful iteration of the program. When it clicks 'save' and id=control_window changes from 10 to 11 (keep in mind it will increase every iteration contril_window_12, 13, 14 and so on.). although every single iframe and div are generated the same, selenium will still be looking at control_window_10 and not be able to find elements. i have tried to index them by Xpath, id, class, ive even tried to dynamically change the numbers myself.

0 Answers
Related