0
<Iframe1>
 <Iframe2>
    <Iframe3> </iframe3>
   <iframe4>
    <input> </input>   ----- on click of this input will launch new 
                                   iframe5
  <input2></input2>   --- then need to perform action on this input
</iframe4>
</Iframe2>
</iframe1>

New Iframe

<Iframe5>
..
..
</iframe5>

Hi i have selenium java code based on POM model. My class createperson will perform action on above mentioned input fields. This class contains current child iframe object only rest all parents iframes are present in other classes

1.On click of first input launches new frame i.e iframe5 which does not belong to any parent I am able to perform action on it

2.But I want to handle the process of coming back to the nested child iframe to perform action on the next input field

I can do this by calling all iframes again now. But I want to handle strategically as I have this functionality on all pages and dont want to write unnecessary code

Class people
{
    Switchto(Iframe1)
}

class peoplesearch extends People
{
    switchto(Iframe2)
}

class createperson
{
    switchto(Iframe4)
}

class control
{
    switchto(defaultcontent)
    switchto(ifrmae5)
    switchto(defaultcontent)
}
Option
  • 2,605
  • 2
  • 19
  • 29

1 Answers1

0

As per the HTML you have shared and your code trial you seem to have cruise through multiple nested <iframe> tags.

Now as you have performed the operations on iframe5 and now want to come back to the nested child iframe perhaps you have to figure out the exact <iframe> tag where the desired element exists and switch to the relevant <iframe> accordingly. Of-coarse you don't have to do this by calling all iframes again. As per the Best Practices you need to induce WebDriverWait before invoking Switchto().

Here you can find a detailed discussion on How to properly wait for a frame to be available in python-selenium?

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352