This blog is for Automation Test Engineers

Friday, 16 February 2018

Handling Frames

Frames is an html document which is embedded inside another document. If we right click on any element in context menu if it shows "this frame" then element is present inside another frame.
Inorder to handle this we should transfer control to frame. This can be done by using 3 ways:

driver.switchTo().frame(int index no);
driver.switchTo().frame(String frame name);
driver.switchTo().frame(Web Element frameElement);

After switching to frame we can perform any operation only within frame. In order to handle the element which is outside frame we should transfer back control to main browser by following statement;

driver.SwitchTo().defaultContent();




1

1 comment: