[英]fill out a registration form with casperjs fill() and a random email address
我有一個用於注冊表格(名稱,電子郵件,密碼)的測試,並且我想擁有它,以便它每次都使用隨機生成的電子郵件地址,因此我不必進行任何清理或編輯測試。 我需要此輔助文件還是可以在測試中完成?
我的片段看起來像這樣-
casper.then(function() {
this.echo('signing up with the follow credentials:', 'COMMENT');
this.fill('.sign_up', {
'name': 'mariah carey',
'email': 'mariahcarey@dododoodo.com',
'password': 'testtest123'
}, true);
在測試腳本中,您可以創建javascript函數,以便隨機生成電子郵件地址。
casper.then(function() {
this.echo('signing up with the follow credentials:', 'COMMENT');
this.fill('.sign_up', {
'name': 'mariah carey',
'email': generatePassword(),
'password': 'testtest123'
}, true);
}
...
function generatePassword(){
var email;
// Here code for generate email
return email;
}
您可以對名稱和密碼進行相同的操作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.