package daylatest;
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 ReadingPropertiesFIles {
public static void main(String[] args) throws IOException {
// Specifying Path
String URL;
String filePath = "C:\\Users\\PRITHWIRAJ PC\\eclipse-workspace\\latestselenium\\dataFile.properties";
//String filepath1="C:\Users\PRITHWIRAJ PC\eclipse-workspace\seleniumBasics\src\ReadingFiles";
// Initializing File Input Stream
FileInputStream fileInputStream = new FileInputStream(filePath);
// Initializing Properties Class
Properties properties = new Properties();
// Loading Properties file
properties.load(fileInputStream);
System.out.println(properties.get("URL"));
String key = "URL";
System.out.println(properties.get(key));
WebDriver driver1=null;
System.setProperty("webdriver.chrome.driver", "C:\\Curde\\chromedriver.exe");
driver1 = new ChromeDriver();
driver1.manage().window().maximize();
//driver = new ChromeDriver();
driver1.get(key);
}
}
Its solved. Just converted the object to string by using valueof