package Techniques.IFrame;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

import java.time.Duration;

public class IframeQs {
    public static void main(String[] args) {
        WebDriver obj = new FirefoxDriver();

        obj.get("https://jqueryui.com/droppable/");

        WebDriverWait wait = new WebDriverWait(obj, Duration.ofSeconds(5));


        obj.switchTo().frame(obj.findElement(By.cssSelector("iframe.demo-frame")));

        Actions drag = new Actions(obj);

        wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("draggable")));
        drag.dragAndDrop(obj.findElement(By.id("draggable")),obj.findElement(By.id("droppable"))).build().perform();

        obj.switchTo().defaultContent();


        drag.scrollByAmount(0,500).build().perform();
    }
}
