What is Iframe?
Let's consider the following HTML source code of the webpage that has an iframe
Select the frame 1
driver.switchTo().frame("frame1");
Select the frame2
driver.switchTo().frame("frame2");
Switching back to the parent window
driver.switchTo().defaultContent(); // you are now outside both frames
An inline frame is used to embed another webpage within the current webpage. The IFrame is often used to insert content from another source, such as an advertisement, into a Web page.
Iframe looks as below.
Let's consider the following HTML source code of the webpage that has an iframe
In the above html snapshot there is an iframe embed into an another iframe. And We have to select the outer Iframe to go to inner Iframe and write in the body.
Next We have to come out from the inner iframe to outer iframe and click on OK button
Directly accessing the above elements is not possible. iframes has its own DOM elements and we have to switch to that particular frame and then we can perform any actions.
Select the frame 1
driver.switchTo().frame("frame1");
Select the frame2
driver.switchTo().frame("frame2");
Switching back to the parent window
driver.switchTo().defaultContent(); // you are now outside both frames
Não ha resiliência sem a capacidade para o pensamento.
ReplyDeleteAtrito amigo ou inimigo?
ReplyDelete