Store current datetime in variable in Selenium IDE and use it for a random email address
I use variables all the time. And to be able to re-use a test over and over again, I need random email addresses whenever I fill in forms.
For this I define a variable with the current date and time and then a variable which will hold the email address which uses the current date and time.
My random email address will look like: firstname.lastname@example.org
Just store the following as 1 string into the ‘Target’ part of your command.
const date=new Date(); return String(date.getFullYear()) + String(date.getMonth()+1) + String(date.getDate()) + '_' + String(date.getHours() < 10 ? "0"+date.getHours() : date.getHours()) + String(date.getMinutes() < 10 ? "0"+date.getMinutes() : date.getMinutes()) + String(date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds())
It will look like this in Selenium IDE:
Now you can use this to create your email address which is unique every time you run your test:
And use it when you want to fill a form.