Hybrid framework with frames | Selenium Python Forum
Sambhav Puri Posted on 17/06/2020

In terms of hybrid framework what are the best practices to wirte a test case considering the page has multiple frames.

For example consider a test case:

1) TypeIn object A in Frame F1

2) TypeIn object B in Frame F2

3) TypeIn object C in Frame F3

4) Click object D in Frame F4

Jaspreet Replied on 22/06/2020


Considering the situation, the same steps are applied to frames if there are multiple frames present be it in Hybrid framework or normal test case.

Firstly you need to check the no. of frames available on the webpage.
Then you need to find the element with which you want to interact with in all the frames if more one than frame is present.

for i in range(0, len(frames)):      #iterating over the no. of frames
    driver.switch_to.frame(i)        #switching to one frame after another 
                                     #element to be found with locator strategy      
    if(b==0):                        #if len of 'b' is 0 then go to the default frame and move further in iterating over frames
    else:                            #if the element is found then perform the action and break the loop