How can I click list of elements in one frame (or) container?



  • enter image description hereIn this image I want to click view buttons as one by one that view buttons have same names. I am using list concept that is not working.enter image description here



  • Selenium provides two methods to deal with iFrames.

    You can search for a iFrame with id IFRAME_ID

    driver.switchTo().frame(IFRAME_ID)
    

    And you can return to the context of the root element:

    driver.switchTo().defaultContent()
    

    Of course, you can chain iFrames:

    driver.switchTo().frame(IFRAME_ID1).switchTo().frame(IFRAME_ID2)
    

    Meaning you will enter in the iFrame with ID IFRAME_ID2 which is inside the IFRAME_ID1.

    If they were siblings, you would need to return to the default context:

    driver.switchTo().frame(IFRAME_ID1);
    driver.switchTo().defaultContent();
    driver.switchTo().frame(IFRAME_ID2);
    

    After switching to a iFrame, you can use WebDriver and WebElements as if the only the DOM branches inside the iFrame exist.


Log in to reply
 

Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2