After successfully resolving my previous issue with the assistance of another user, I'm now encountering a new problem related to the following code snippet:
const faker = require('faker');
const userList = require('./users.json')
var jsonfile = require('jsonfile');
var obj={
'table':[]
};
for (i=0; i <10 ; i++){
let username = faker.internet.userName();
let password = faker.internet.password();
obj.table.push({"id":i,name:username,pass: password});
}
jsonfile.writeFile('users.json', obj, {spaces:2}, function(err){
console.log(err);
});
console.log(userList.table);
If I execute the command :
console.log(userList.table[0].name);
console.log(userList.table[0].pass);
The above correctly displays the password, but my objective is to utilize this data by using .type(then the user+ pass) to automate typing those out. To achieve this, I need guidance on how to either move on to the next line automatically [1], or if it's simpler to remove and transfer the data into a new JSON file.
I am implementing this for testing sign-up functionality on a website.
- Visit the website and wait for selector
- Enter the user and password generated by faker
- Retrieve and save the user and password generated by faker in another location
- Proceed to the next user and password iteration and repeat the steps
Any assistance would be greatly appreciated,
Thank you!