Tutorial by Examples

For an instance, if the html source code of an html view or element is wrapped by an iframe like this: <iframe src="../images/eightball.gif" name="imgboxName" id="imgboxId"> <p>iframes example</p> <a href="../images/redball.gif" t...
To switch focus to either main document or first frame of the page. You have to use below syntax. driver.switchTo().defaultContent();
1. Switch to a frame by Index. Here we are switching to index 1. Index refers to the order of frames on the page. This should be used as a last resort, as frame id or names are much more reliable. driver.SwitchTo().Frame(1); 2. Switch to a frame by Name driver.SwitchTo().Frame("Name_Of_Fr...
To switch focus to either main document or first frame of the page. You have to use below syntax. webDriver.SwitchTo().DefaultContent();
Consider you have a Parent Frame(Frame-Parent). and 2 child frames(Frame_Son,Frame_Daughter). Lets see various conditions and how to handle. 1.From Parent to Son or Daughter: driver.switchTo().frame("Frame_Son"); driver.switchTo().frame("Frame_Daughter"); 2.From Son to Pa...
In quite a few cases your frame might not show up immediately and you probably have to wait till it is loaded to switch. Or else you will have NoSuchFrameException. So its always a good choice to wait before you switch. Following is a ideal way to wait till a frame is loaded. try{ new Web...

Page 1 of 1