Skip to content

Commit 855cee2

Browse files
committed
- Updated to the latest WebDriverManager version
- Edge browser support added
1 parent 16ac1ab commit 855cee2

File tree

7 files changed

+109
-44
lines changed

7 files changed

+109
-44
lines changed

Diff for: .gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/.idea/
2+
/target/

Diff for: pom.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
66

7-
<groupId>com.step2qa</groupId>
7+
<groupId>com.qaffe</groupId>
88
<artifactId>webdrivermanager-demo</artifactId>
9-
<version>1.0.1</version>
9+
<version>1.1.0</version>
1010

1111
<dependencies>
1212
<dependency>
1313
<groupId>org.testng</groupId>
1414
<artifactId>testng</artifactId>
15-
<version>7.0.0-beta3</version>
15+
<version>7.4.0</version>
1616
<scope>test</scope>
1717
</dependency>
1818
<dependency>
@@ -23,7 +23,7 @@
2323
<dependency>
2424
<groupId>io.github.bonigarcia</groupId>
2525
<artifactId>webdrivermanager</artifactId>
26-
<version>3.2.0</version>
26+
<version>4.4.3</version>
2727
</dependency>
2828
</dependencies>
2929

Diff for: src/test/java/com/step2qa/TestChrome.java renamed to src/test/java/com/qacaffe/TestChrome.java

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.step2qa;
1+
package com.qacaffe;
22

33
import io.github.bonigarcia.wdm.WebDriverManager;
44
import org.openqa.selenium.By;
@@ -11,8 +11,8 @@
1111
import org.testng.annotations.Test;
1212

1313
/**
14-
* @author Rahul R on 1/11/2019
15-
* @version 1.0.1
14+
* @author Rahul R on 1/11/2021
15+
* @version 1.1.0
1616
*/
1717
public class TestChrome {
1818

@@ -31,19 +31,20 @@ public void setup() {
3131
}
3232

3333
@Test
34-
public void openStep2QA_chrome() throws InterruptedException {
34+
public void openQACaffe_chrome() throws InterruptedException {
3535

36-
driver.findElement(By.name("q")).sendKeys("Step2QA");
36+
driver.findElement(By.name("q")).sendKeys("QACaffe RahulR");
3737

3838
driver.findElement(By.name("q")).sendKeys(Keys.ENTER);
3939

4040
Thread.sleep(5000);
4141

42-
driver.findElement(By.xpath("//ol//a[contains(text(),'Elevate Quality Engineering')]")).click();
42+
driver.findElement(By.xpath("//h3[text()='QACaffe By RahulR']")).click();
4343

4444
Thread.sleep(5000);
4545

46-
Assert.assertEquals(driver.getTitle(), "Step2QA – Elevate Quality Engineering", "Failed to open the clicked site.");
46+
Assert.assertEquals(driver.getTitle(), "QACaffe By RahulR",
47+
"Failed to open the clicked site.");
4748

4849
}
4950

Diff for: src/test/java/com/qacaffe/TestEdge.java

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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.chrome.ChromeDriver;
8+
import org.openqa.selenium.edge.EdgeDriver;
9+
import org.testng.Assert;
10+
import org.testng.annotations.AfterTest;
11+
import org.testng.annotations.BeforeTest;
12+
import org.testng.annotations.Test;
13+
14+
/**
15+
* @author Rahul R on 1/11/2021
16+
* @version 1.1.0
17+
*/
18+
public class TestEdge {
19+
20+
private WebDriver driver;
21+
22+
@BeforeTest
23+
public void setup() {
24+
25+
WebDriverManager.edgedriver().setup();
26+
driver = new EdgeDriver();
27+
28+
driver.manage().window().maximize();
29+
30+
driver.get("https://www.google.com");
31+
32+
}
33+
34+
@Test
35+
public void openQACaffe_edge() throws InterruptedException {
36+
37+
driver.findElement(By.name("q")).sendKeys("QACaffe RahulR");
38+
39+
driver.findElement(By.name("q")).sendKeys(Keys.ENTER);
40+
41+
Thread.sleep(5000);
42+
43+
driver.findElement(By.xpath("//h3[text()='QACaffe By RahulR']")).click();
44+
45+
Thread.sleep(5000);
46+
47+
Assert.assertEquals(driver.getTitle(), "QACaffe By RahulR",
48+
"Failed to open the clicked site.");
49+
50+
}
51+
52+
@AfterTest
53+
public void teardown() {
54+
driver.quit();
55+
}
56+
57+
}

Diff for: src/test/java/com/step2qa/TestFirefox.java renamed to src/test/java/com/qacaffe/TestFirefox.java

+8-11
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
package com.step2qa;
1+
package com.qacaffe;
22

33
import io.github.bonigarcia.wdm.WebDriverManager;
44
import org.openqa.selenium.By;
55
import org.openqa.selenium.Keys;
66
import org.openqa.selenium.WebDriver;
77
import org.openqa.selenium.WebElement;
8-
import org.openqa.selenium.chrome.ChromeDriver;
98
import org.openqa.selenium.firefox.FirefoxDriver;
109
import org.testng.Assert;
1110
import org.testng.annotations.AfterTest;
1211
import org.testng.annotations.BeforeTest;
1312
import org.testng.annotations.Test;
1413

1514
/**
16-
* @author Rahul R on 1/11/2019
17-
* @version 1.0.1
15+
* @author Rahul R on 1/11/2021
16+
* @version 1.1.0
1817
*/
1918
public class TestFirefox {
2019

@@ -33,22 +32,20 @@ public void setup() {
3332
}
3433

3534
@Test
36-
public void openStep2QA_firefox() throws InterruptedException {
35+
public void openQACaffe_firefox() throws InterruptedException {
3736

38-
driver.findElement(By.name("q")).sendKeys("Step2QA");
37+
driver.findElement(By.name("q")).sendKeys("QACaffe RahulR");
3938

4039
driver.findElement(By.name("q")).sendKeys(Keys.ENTER);
4140

4241
Thread.sleep(5000);
4342

44-
WebElement link = driver.findElement(By.xpath("//*[contains(text(),'Elevate Quality Engineering')]"));
45-
46-
link.click();
43+
driver.findElement(By.xpath("//h3[text()='QACaffe By RahulR']/parent::a")).click();
4744

4845
Thread.sleep(5000);
4946

50-
Assert.assertEquals(driver.getTitle(), "Step2QA – Elevate Quality Engineering", "Failed to open the clicked site.");
51-
47+
Assert.assertEquals(driver.getTitle(), "QACaffe By RahulR",
48+
"Failed to open the clicked site.");
5249
}
5350

5451
@AfterTest

Diff for: src/test/java/com/step2qa/TestIExplorer.java renamed to src/test/java/com/qacaffe/TestIExplorer.java

+11-13
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1-
package com.step2qa;
1+
package com.qacaffe;
22

33
import io.github.bonigarcia.wdm.WebDriverManager;
44
import org.openqa.selenium.By;
55
import org.openqa.selenium.Keys;
66
import org.openqa.selenium.WebDriver;
7-
import org.openqa.selenium.WebElement;
8-
import org.openqa.selenium.firefox.FirefoxDriver;
97
import org.openqa.selenium.ie.InternetExplorerDriver;
108
import org.testng.Assert;
119
import org.testng.annotations.AfterTest;
1210
import org.testng.annotations.BeforeTest;
1311
import org.testng.annotations.Test;
1412

1513
/**
16-
* @author Rahul R on 1/11/2019
17-
* @version 1.0.1
14+
* @author Rahul R on 1/11/2021
15+
* @version 1.1.0
1816
*/
1917
public class TestIExplorer {
2018

@@ -34,22 +32,22 @@ public void setup() {
3432
}
3533

3634
@Test
37-
public void openStep2QA_iExplorer() throws InterruptedException {
35+
public void openQACaffe_iExplorer() throws InterruptedException {
3836

39-
driver.findElement(By.name("q")).sendKeys("Step2QA");
37+
System.err.println("As Microsoft already closed the IE Project, there might be chances the code may fail.");
4038

41-
driver.findElement(By.name("q")).sendKeys(Keys.ENTER);
39+
driver.findElement(By.name("q")).sendKeys("QACaffe RahulR");
4240

43-
Thread.sleep(5000);
41+
driver.findElement(By.name("q")).sendKeys(Keys.ENTER);
4442

45-
WebElement link = driver.findElement(By.xpath("//*[contains(text(),'Elevate Quality Engineering')]"));
43+
Thread.sleep(10000);
4644

47-
link.click();
45+
driver.findElement(By.xpath("//h3[text()='QACaffe By RahulR']/parent::a")).click();
4846

4947
Thread.sleep(5000);
5048

51-
Assert.assertEquals(driver.getTitle(), "Step2QA – Elevate Quality Engineering", "Failed to open the clicked site.");
52-
49+
Assert.assertEquals(driver.getTitle(), "QACaffe By RahulR",
50+
"Failed to open the clicked site.");
5351
}
5452

5553
@AfterTest

Diff for: testng.xml

+19-9
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,41 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<suite name="WebDriverManager Demo" verbose="10" parallel="false" thread-count="1">
33

4-
<test name="Open Step2QA in Google Chrome browser.">
4+
<test name="Open QACaffe in Google Chrome browser.">
55
<classes>
6-
<class name="com.step2qa.TestChrome">
6+
<class name="com.qacaffe.TestChrome">
77
<methods>
8-
<include name="openStep2QA_chrome"/>
8+
<include name="openQACaffe_chrome"/>
99
</methods>
1010
</class>
1111
</classes>
1212
</test>
1313

14-
<test name="Open Step2QA in Mozilla Firefox browser.">
14+
<test name="Open QACaffe in MS Edge browser.">
1515
<classes>
16-
<class name="com.step2qa.TestFirefox">
16+
<class name="com.qacaffe.TestEdge">
1717
<methods>
18-
<include name="openStep2QA_firefox"/>
18+
<include name="openQACaffe_edge"/>
1919
</methods>
2020
</class>
2121
</classes>
2222
</test>
2323

24-
<test name="Open Step2QA in Internet Explorer browser.">
24+
<test name="Open QACaffe in Mozilla Firefox browser.">
2525
<classes>
26-
<class name="com.step2qa.TestIExplorer">
26+
<class name="com.qacaffe.TestFirefox">
2727
<methods>
28-
<include name="openStep2QA_iExplorer"/>
28+
<include name="openQACaffe_firefox"/>
29+
</methods>
30+
</class>
31+
</classes>
32+
</test>
33+
34+
<test name="Open QACaffe in Internet Explorer browser.">
35+
<classes>
36+
<class name="com.qacaffe.TestIExplorer">
37+
<methods>
38+
<include name="openQACaffe_iExplorer"/>
2939
</methods>
3040
</class>
3141
</classes>

0 commit comments

Comments
 (0)