Creating Properties File Dynamically
Create Object Repository in Selenium
Step -1 Create a file object and make a connection with xls file from which we want to pick data
File f = new File(“C:\\abc.xls”) Here we have given an absolute path to the file
File f= new File(“./src/input.xls”);
Step-2 Create a file object and make a connection with properties file to which we want to place data
File f = new File(“C:\\abc.properties”) Here we have given an absolute path to the file
File f= new File(“./src/test.properties”);
Step-3 Create an object for Properties class
Properties p = new Properties();
Step-4 Add properties to properties file
p.setproperty(“propname”,”Propvalue”);
* Add all properties that we want to add
Step-5 Create a FileOutputStream object
FileOutput stream is used to write data to any output file.
FileOutputStream f1= new FileOutputStram(fileobjectforpropertyfile)
Prop.store(f1,”Message For First Line”)
f1.Close();
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment