问题所需的解决方案:
ID 是固定的“质量保证”我想生成如下 ID:1- q.ualityassurance
对于第二次运行 id 应该是这样的:2- qu.alityassurance
第三次运行应该是这样的: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);
}