In this video, I have explained about how we can handle Frames in Selenium WebDriver.
Frames are a now deprecated. You might not get chance to work with them unless you are working with a pre-HTML5 web app. Iframes allow the insertion of a document from an entirely different domain and are still commonly used.
To interact with any control inside the frame, we will need to first switch to the frame, in a similar way to how we switch windows. WebDriver has three ways of switching to a frame.
1) Using an index
2) Using a name or ID
3) Using a WebElement
***** Using an index *****
It is possible to use the index of the frame to switch to that frame, such as can be queried using window.frames in JavaScript.
The first frame on the webpage has index 0.
Example:
//Switch to the first frame
driver.switchTo().frame(0);
***** Using a name or id *****
If webpage frame has id or name inside html. Then the name or ID can be user to identify frame and switched to.
Example:
//Using id or name
driver.switchTo().frame("frame1");
***** Using a WebElement *****
Switching using a WebElement is the most flexible option. You can find the frame using your preferred selector and switch to it.
Example:
//Store the web element
WebElement frame = driver.findElement(By.id("frame1"));
driver.switchTo().frame(frame);
Nesta página do site você pode assistir ao vídeo on-line How to Handle Frames in Selenium WebDriver | Selenium - Java duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário CodeWithAvadoot 13 Março 2021, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 220 vezes e gostou 11 espectadores. Boa visualização!