Already tried this solution but no luck yet :
My Code:
protected WebDriver driver;
public static Properties prop;
@BeforeSuite
public void setup()
{
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-notifications");
System.setProperty("webdriver.chrome.driver","E:\\chromedriver.exe");
driver = new ChromeDriver(options);
//Calling property file function here
ReadData();
driver.get(prop.getProperty("URL"));
}
public void ReadData()
{ prop = new Properties();
try {
prop.load(new FileInputStream("D:\\projectname\\src\\main\\resources\\DataFile.properties"));
} catch (IOException e) {
e.printStackTrace();
}}
Getting Exception :
java.io.FileNotFoundException
File is already there and I have tried lot of diff. file path like full path, path starts from src
ect.
Project Structure :
UPATE :
- It works when I removed
.properties
extension from filepath. - Still I am not sure that why intellij did not add file extension as .properties. Because I am sure that I have created file with type
properties
.