First you need to create iam.properties file in our webdriver project
name=yogi
college=crazyfun
age=22
browser=firefox
testSiteName=xyz.com
environment=UAT
//**********************
public class ReadProperties {
public static void main(String[] args) throws IOException {
FileInputStream fs = new FileInputStream("F:\\Workspaces\\..\\..\\iam.properties");
Properties prop = new Properties();
prop.load(fs);
System.out.println(prop.getProperty("college"));
System.out.println(prop.getProperty("company"));
System.out.println(prop.getProperty("name"));
}
}
name=yogi
college=crazyfun
age=22
browser=firefox
testSiteName=xyz.com
environment=UAT
//**********************
public class ReadProperties {
public static void main(String[] args) throws IOException {
FileInputStream fs = new FileInputStream("F:\\Workspaces\\..\\..\\iam.properties");
Properties prop = new Properties();
prop.load(fs);
System.out.println(prop.getProperty("college"));
System.out.println(prop.getProperty("company"));
System.out.println(prop.getProperty("name"));
}
}
Hi,
ReplyDeleteCan you please tell us how above script will run on firefox browser ?
I means how we can trigger firefox through properties file ?
Thanks,