package paa_class_1;
import java.time.Duration;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class assignment1 {
public static void main(String[] args) throws InterruptedException {
// TODO Auto-generated method stub
FirefoxDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
driver.manage().window().maximize();
driver.get("http://clm.seliselocal.com/");
driver.findElement(By.cssSelector("button#mat-button-toggle-2-button")).click();
Thread.sleep(3000);
driver.findElement(By.cssSelector("input[formcontrolname='Email']")).sendKeys("automateProjectManager@yopmail.com");
driver.findElement(By.cssSelector("input[formcontrolname='Password']")).sendKeys("CLMTestPass2023");
Thread.sleep(3000);
driver.findElement(By.cssSelector("button[aria-label='LOGIN']")).click();
Thread.sleep(3000);
//driver.findElement(By.cssSelector("fuse-nav-vertical-item:nth-child(5)")).click();
driver.findElement(By.cssSelector("fuse-nav-vertical-item:nth-child(5) > a:nth-child(1)")).click();
Thread.sleep(3000);
driver.findElement(By.cssSelector("input#mat-input-3")).sendKeys("PAA Training by AutoMATE");
Thread.sleep(3000);
driver.findElement(By.cssSelector("p.subtitle-1.text-ellipsis.m-0")).click();
Thread.sleep(3000);
driver.findElement(By.cssSelector("button.mat-focus-indicator.add-button.mat-raised-button.mat-button-base.mat-primary")).click();
Thread.sleep(3000);
driver.findElement(By.cssSelector("input#SiteName")).sendKeys("Lamia");
driver.findElement(By.cssSelector("input#google-autoComplete")).sendKeys("Mohammadpur");
driver.findElement(By.cssSelector("body > div.pac-container.pac-logo.hdpi > div:nth-child(1)")).click();
Thread.sleep(1000);
driver.findElement(By.cssSelector("input#Zip")).sendKeys("1205");
driver.findElement(By.cssSelector("input#ContactPersonName")).sendKeys("Lamia");
driver.findElement(By.cssSelector("input#ContactPersonEmail")).sendKeys("afsara.lamia@selise.ch");
driver.findElement(By.cssSelector("input#ContactPersonPhone")).sendKeys("01798147004");
/*JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("window.scrollTo(0, document.body.scrollHeight)");*/
//driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.END);
//JavascriptExecutor js = (JavascriptExecutor) driver;
//Scroll down till the bottom of the page
//js.executeScript("window.scrollBy(0,document.body.scrollHeight)");
Thread.sleep(2000);
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("arguments[0].scrollIntoView();", driver.findElement(By.cssSelector("input#mat-input-13")));
Thread.sleep(500);
driver.findElement(By.cssSelector("input#mat-input-13")).click();
driver.findElement(By.cssSelector("button[aria-label='Next month']")).click();
driver.findElement(By.cssSelector("button[aria-label='Next month']")).click();
driver.findElement(By.cssSelector("button[aria-label='28 August 2023']")).click();
Thread.sleep(500);
driver.findElement(By.cssSelector("input#mat-input-14")).click();
driver.findElement(By.cssSelector("button[aria-label='Choose month and year']")).click();
driver.findElement(By.cssSelector("button[aria-label='2023']")).click();
driver.findElement(By.cssSelector("tbody tr:nth-child(4) td:nth-child(2) button:nth-child(1)")).click();
driver.findElement(By.cssSelector("button[aria-label='24 October 2023']")).click();
Thread.sleep(500);
driver.findElement(By.cssSelector("textarea#Notice")).sendKeys("Test");
driver.findElement(By.cssSelector("button.mat-focus-indicator.ml-12.submit-button.mat-raised-button.mat-button-base.mat-primary")).click();
/*List <WebElement> data= driver.findElements(By.cssSelector("div[class='autocomplete-items']div"));
for (WebElement datas : data) {
if (datas.getText().equals("Bangladesh")) {
datas.click();
break;
}
}*/
//driver.findElement(By.xpath("//a[normalize-space()='']")).click();
//driver.findElement(By.linkText("Login")).click();
}
}