So I am running automated test using selenium
I have below code in test.js
driver = new webdriver.Builder().withCapabilities(webdriver.Capabilities.chrome()).setChromeOptions(o).build();
Above code opens new browser every time when i run it using command node test.js
But I want to save the object driver and then reuse it.. so that when i run node test.js it wont reopen the browser..but use already opened browser.So I tried something like below and it failed with json error , unexpected ending
var savefile = fs.writeFile('data.json', JSON.stringify(util.inspect(driver)) , 'utf-8');
var parsedJSON = require('./data.json');
console.log(parsedJSON);
so I tried like if file exist , use the object from file .. else create new object.Will above method actually work or is there any other method.
via Vishnu
No comments:
Post a Comment