問題に必要な解決策:
Id は 'qualityassurance' に固定されています。次のような ID を生成したいです。1- q.ualityassurance
2 回目の実行 ID は次のようになります。2- qu.alityassurance
3回目の実行では、次のようになります。3- qua.lityassurance
idの長さまで続きます。しかし、インクリメントされた値で次の実行のために関数を呼び出す方法がわかりません。
コードは次のとおりです。
Selenium.prototype.doNothing = function(){
// The do in front of Nothing in the function is what tells the system this is a global function
}
Selenium.prototype.doRandomEmail = function(locator, num)
{
var id = “qualityassurancetask”;
var stringLength = id.length;
var randomstring = ”;
var insstring = ‘.’;
var num = 1;
//var rnum = Math.floor(Math.random() * stringLength);
var remainingstring = id.substring(num,id.length);
randomstring += id.substring(0,num).concat(insstring, remainingstring);
randomstring += “@gmail.com”
num= num+1;
selenium.doType(locator,randomstring,num);
}