How to add environment variable(with Key and Value pair) run time in keyword Driven Framework
Instructor
09914040666 Replied on 08/12/2020
Hey,
You can add environment variable(with Key and Value pair) using the 'os' module in python. Like this:
os.environ['KEY'] = 'VALUE'
Can I Use same code even to add a Environment Variables in my Keywor Driven Framework during the run time
Instructor
09914040666 Replied on 08/12/2020
Yes.
Thanks for the response
On executing below line of code with varcount being dynamic value. I am getting error "SyntaxError: invalid syntax (<string>, line 1)" error. Unable to get to know the exact issue. Can you please help me in unblocking.
os.environ['Projectname'] = '/html/body/div[1]/div[1]/div/table/tbody/tr[1]/td['+varcount+']/a'
I am able to add the dictionary successfully after adding the same in the try catch block.
But the 'Projectname' key and its Value is not added to environment variables of the project framework.
Instructor
09914040666 Replied on 08/12/2020
Please let me know the requirement of 'ProjectName' to be added in environment variable and kindly send the snippet for the code so that I can check.