How to fill value in textbox using iframe
2 answers
If you want to do something inside frame
. First you need to go inside the frame.
Code to enter the frame:
//Assume driver is initiated properly some where.
driver.switchTo.frame(FrameName);
(Or)
driver.switchTo.frame(FrameIndexValue);
(Or)
WebElement element = driver.findElement(By.id(LocatorValue));
driver.switchTo.frame(element);
After completing the action inside the frame. You have to get out of the box using
to leave a border:
driver.switchTo.defaultContent();
If you are dealing with iframe
, then defaultContent () will take you to the main page above all frames, but if you are dealing with frame
, this method will take you to the first frame of the page.
+1
source to share