diff --git a/src/main/java/AAMphasis2/Selenium.java b/src/main/java/AAMphasis2/Selenium.java index 29b6d9e..7a3ed3c 100644 --- a/src/main/java/AAMphasis2/Selenium.java +++ b/src/main/java/AAMphasis2/Selenium.java @@ -10,6 +10,8 @@ import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.openqa.selenium.By; +import org.openqa.selenium.JavascriptExecutor; +import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; @@ -43,9 +45,10 @@ public static void main(String[] args) throws IOException, InterruptedException driver.switchTo().window(cw); System.out.println(driver.getTitle()); driver.findElement(By.xpath("//button[text()='Take me to the tips! ']")).click(); - - //SubHeading - List lists = driver.findElements(By.xpath("//div[@class=\"row\"]/descendant::button[2]/child::small")); + + // SubHeading + List lists = driver + .findElements(By.xpath("//div[@class=\"row\"]/descendant::button[2]/child::small")); System.out.println(lists.size()); Actions action = new Actions(driver); for (WebElement getList : lists) { @@ -54,7 +57,7 @@ public static void main(String[] args) throws IOException, InterruptedException System.out.println(getList.getText()); continue; } - //Heading + // Heading List Headers = driver.findElements(By.xpath("//div[@class=\"card__header\"]//a")); System.out.println(Headers.size()); for (WebElement getHeaders : Headers) { @@ -63,11 +66,24 @@ public static void main(String[] args) throws IOException, InterruptedException System.out.println(getHeaders.getText()); continue; } - + driver.close(); } } driver.switchTo().window(pw); + driver.navigate().refresh(); + System.out.println(driver.getTitle()); + Thread.sleep(2000); + Actions action = new Actions(driver); + action.keyDown(Keys.CONTROL).sendKeys("R").keyUp(Keys.CONTROL).build().perform(); + Thread.sleep(2000); + System.out.println(driver.getTitle()); + JavascriptExecutor js = (JavascriptExecutor) driver; + js.executeScript("location.reload();"); + Thread.sleep(2000); + System.out.println(driver.getTitle()); + driver.navigate().to(driver.getCurrentUrl()); + System.out.println(driver.getTitle()); driver.quit(); } } diff --git a/target/classes/AAMphasis2/Selenium.class b/target/classes/AAMphasis2/Selenium.class index be97757..8b22048 100644 Binary files a/target/classes/AAMphasis2/Selenium.class and b/target/classes/AAMphasis2/Selenium.class differ