|
| 1 | +package com.qacaffe; |
| 2 | + |
| 3 | +import io.github.bonigarcia.wdm.WebDriverManager; |
| 4 | +import org.openqa.selenium.By; |
| 5 | +import org.openqa.selenium.Keys; |
| 6 | +import org.openqa.selenium.WebDriver; |
| 7 | +import org.openqa.selenium.ie.InternetExplorerDriver; |
| 8 | +import org.testng.Assert; |
| 9 | +import org.testng.annotations.AfterTest; |
| 10 | +import org.testng.annotations.BeforeTest; |
| 11 | +import org.testng.annotations.Test; |
| 12 | + |
| 13 | +/** |
| 14 | + * @author Rahul R on 1/11/2021 |
| 15 | + * @version 1.1.0 |
| 16 | + */ |
| 17 | +public class TestIExplorer { |
| 18 | + |
| 19 | + private WebDriver driver; |
| 20 | + |
| 21 | + @BeforeTest |
| 22 | + public void setup() { |
| 23 | + |
| 24 | + WebDriverManager.iedriver().setup(); |
| 25 | + WebDriverManager.iedriver().arch32().setup(); |
| 26 | + driver = new InternetExplorerDriver(); |
| 27 | + |
| 28 | + driver.manage().window().maximize(); |
| 29 | + |
| 30 | + driver.get("https://www.google.com"); |
| 31 | + |
| 32 | + } |
| 33 | + |
| 34 | + @Test |
| 35 | + public void openQACaffe_iExplorer() throws InterruptedException { |
| 36 | + |
| 37 | + System.err.println("As Microsoft already closed the IE Project, there might be chances the code may fail."); |
| 38 | + |
| 39 | + driver.findElement(By.name("q")).sendKeys("QACaffe RahulR"); |
| 40 | + |
| 41 | + driver.findElement(By.name("q")).sendKeys(Keys.ENTER); |
| 42 | + |
| 43 | + Thread.sleep(10000); |
| 44 | + |
| 45 | + driver.findElement(By.xpath("//h3[text()='QACaffe By RahulR']/parent::a")).click(); |
| 46 | + |
| 47 | + Thread.sleep(5000); |
| 48 | + |
| 49 | + Assert.assertEquals(driver.getTitle(), "QACaffe By RahulR", |
| 50 | + "Failed to open the clicked site."); |
| 51 | + } |
| 52 | + |
| 53 | + @AfterTest |
| 54 | + public void teardown() { |
| 55 | + driver.quit(); |
| 56 | + } |
| 57 | + |
| 58 | +} |
0 commit comments