iframes
IFRAMES: stands for Inline Frame
What is Iframe?
It is basically HTML inside of another HTML
How do we handle Iframe?
- Selenium can only focus on one thing at time.
- Therefore we need to switch the driver's focus to
specific frame to be able to do any action in it.
syntax: driver.switchTo().frame();
3 different ways of handling/switching to iframe
- 3 ways to switch
#1- byIndex: We pass the index number of desired web element.
#2- id or name: We can pass id or name attribute value directly to switch.
#3- WebElement: locate web element and pass WebElement value directly to switch.
driver.switchTo().frame(WebElement);