How to handle frame window in selenium?

package webElementMethods;


import java.util.concurrent.TimeUnit;


import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.WebElement;

import org.openqa.selenium.chrome.ChromeDriver;


public class HandleFrameGetAttributes {


public static void main(String[] args) {

System.setProperty("webdriver.chrome.driver",

"D:\\Software\\Testing-Tools\\Selenium\\WebDriver\\Drivers\\IEChromeFirefox\\19092018\\chromedriver.exe");

WebDriver driver = new ChromeDriver();

driver.manage().window().maximize();

driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

driver.get("https://jqueryui.com/draggable/");


WebElement frameBox = driver.findElement(By.xpath("//*[@id=\"content\"]/iframe"));

driver.switchTo().frame(frameBox);

System.out.println(driver.findElement(By.id("draggable")).getAttribute("style"));

driver.switchTo().defaultContent();

}


}


Comments