-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIframeExample1.java
More file actions
27 lines (19 loc) · 781 Bytes
/
Copy pathIframeExample1.java
File metadata and controls
27 lines (19 loc) · 781 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class IframeExample1 {
public static void main(String[] args) throws InterruptedException {
WebDriver driver = new ChromeDriver();
driver.get("https://demo.guru99.com/test/guru99home/");
driver.manage().window().maximize();
//1.Switch to iframe using name or id
driver.switchTo().frame("a077aa5e");
//2.now you are able to click on the image. bcz it is inside the iframe
driver.findElement(By.xpath("//img")).click();
Thread.sleep(10000);
//3.go back to main page
driver.switchTo().defaultContent();
//Close browser
//driver.quit();
}
}