Krishna_Kumar
7 years agoContributor
Project Variable
 Hi Team, 
 i am trying to Create a object at run time and pass the same object for all other script. 
 for example, 
 in Method1 - i have created an excel object(Excel.Applilcation) 
 in Method2 - i ...
- 7 years agoHi Krishna_Kumar , initialize all your required objects in the OnStartTest Event handler and assign the same objects to a project variable in the same time, and after that were ever you want you van use the required object by assigning a new temperory variable, please refer the below code snippet for your reference and let me know if your problem is solved. //Event Handler function GeneralEvents_OnStartTest(Sender){ if(Project.Variables.VariableExists("MyObject")) Project.Variables.RemoveVariable("MyObject") Project.Variables.AddVariable("MyObject", "Object"); Project.Variables.MyObject = Sys.OleObject("Excel.Application") } //Accessing the Project Variable in different script Routine function testingprojectVariable() { excelApp = Project.Variables.VariableByName("MyObject") excelApp.Workbooks.Open("C:\\Users\\sathishkumark\\Desktop\\Source.xlsx") excelApp.DisplayAlerts = true
 ////Your Excel Operations...
 .............. }