Moving back to parent frame in Selenium

前端 未结 2 836
无人共我
无人共我 2021-01-16 11:39

For moving back to parent frame in Selenium, driver.switchTo().parentFrame(); is used. In my example website, I achieved same functionality using driver.s

2条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-16 11:55

    It does have difference to an extent. Suppose you have a page having frame 'three' inside a frame 'two' inside another frame 'one', considering that you are on the frame 'three' which is inner most...

    driver.switchTo().parentFrame(); - This will shift focus back to frame 'two'. driver.switchTo().defaultContent(); - This will shift focus back to main (default) content in which frame 'one' lies.

    I hope this was helpful. Thanks !

提交回复
热议问题