当我在j的ii循环中获得ii值时,它将重新运行ii的las值,而不是第一次隐藏。 这是我的代码
var tot_cnt = element.all(by.repeater("el in leaveApproved | orderBy:'Applied_Date' track by $index")).count().then(function(lev_req)
{
if(lev_req > 0)
{
for ( var i=1; i <= lev_req ; i++)
{
var ii=i;
//getting empl number
var em = element(by.xpath("//*[@id='ibox_load']/table/tbody/tr["+ ii +"]/td[2]/div/div[2]/small[1]")).getText().then(function(emply_numb)
{
var em1 = element(by.xpath("//*[@id="ibox_load"]/table/tbody/tr["+ii+"]/td[2]/div/div[2]/span")).getText().then(function(leave_count)
{
if(emply_numb == "188" && leave_count > 1)
{
for( var j=1; j <= leave_count; j++ )
{
var jj=j;
console.log("ivalue"+ii); //here i get the last value of ii but i need the value from 1,2,3... like that
var st_dt_tmp = element(by.xpath("//*[@id='ibox_load']/table/tbody/tr["+ii+"]/td[3]/div["+jj+"]/div[1]/div[2]/strong[1]")).getText().then(function(st_tmp)
{
console.log("bf st dt "+st_tmp);
});
var ed_dt_tmp = element(by.xpath("//*[@id='ibox_load']/table/tbody/tr["+ii+"]/td[3]/div["+jj+"]/div[1]/div[2]/strong[2]")).getText().then(function(ed_tmp)
{
console.log("start "+ed_tmp+"and end date is"+end_date);
});
}
}
});
});
}
}
});
当“ ii”进入j进行循环时,我需要ii,1、2、3以后的值