-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReadFromPropertyFile.java
More file actions
29 lines (21 loc) · 926 Bytes
/
ReadFromPropertyFile.java
File metadata and controls
29 lines (21 loc) · 926 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package DemoTest.Test1;
import static org.testng.Assert.assertEquals;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class ReadFromPropertyFile {
//fetching data from data.properties file in the program
public static void main(String args[]) throws IOException {
Properties props = new Properties();
FileInputStream reader = new FileInputStream("C:\\Users\\vinit\\eclipse-workspace\\Test1\\src\\test\\java\\DemoTest\\Test1\\data.properties");
props.load(reader);
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get(props.getProperty("URL"));
String actualTitle = props.getProperty("Title");
String expectedTitle = driver.getTitle();
assertEquals(actualTitle, expectedTitle);
}
}