简体   繁体   中英

How to execute code based on POPUP visibility javascript

I have 3 rows in a table with the following ID :

listdefintion421_1_41-rowse10;
listdefintion421_1_41-rowsel2;
listdefintion421_1_41-rowsel3;

and a buttom with the Following ID : buttonZrd8UldL24I31BcWSIkSiW_36

When I execute this command in the console :

var btn1 = document.getElementById('listdefintion421_1_41-rowsel0'); 
btn1.click();
var okBtn = document.getElementById('buttonZrd8UldL24I31BcWSIkSiW_36'); 
okBtn.click();

The following popup appears and the visibility is visible:

var popupVisibility= document.getElementById("sap-ui-blocklayer-popup").style.visibility;

Is it possible to automate the following logic?

//Ok btn
var okBtn = document.getElementById('buttonZrd8UldL24I31BcWSIkSiW_36');
//Popup 
var popupVisibility= document.getElementById("sap-ui-blocklayer-popup").style.visibility;

//This will click on row1 
var btn1 = document.getElementById('listdefintion421_1_41-rowsel0'); 
btn1.click();

//Click the ok Btn
okBtn.click();


/* I'm sutck here */
//I want when popupVisibility change from visible to hidden, the below code should execute


//This will click on row2
var btn2 = document.getElementById('listdefintion421_1_41-rowsel2'); 
btn2.click();

//Click the ok Btn
okBtn.click();


/* I'm sutck here */
//Again, when popupVisibility change from visible to hidden the below code should execute 

var btn3 = document.getElementById('listdefintion421_1_41-rowsel3'); 
btn3.click();

//Click the ok Btn
okBtn.click();

Update

So far I have come up with this:

var RowIds = [ "2", "3","4","5","7","9"];




function funcE(i) {

 var rowBtn= document.getElementById('listdefintion421_1_41-rowsel'+i);
 rowBtn.click(); 
 var btnok = document.getElementById('buttonZrd8UldL24I31BcWSIkSiW_36');
 btnok.click();

}


for( var i=0 ; i< RowIds.length ; i++)
{

    funcE(RowIds[i]);
     var visibility = document.getElementById("sap-ui-blocklayer-popup").style.visibility;
    while(visibility == "visible")
    {

      visibility = document.getElementById("sap-ui-blocklayer-popup").style.visibility;
    }

is it possible to increment the i value once the popup change from visible to hidden?

A possible way would be to create an Intervall which Checks the visibility of the Pop-up. If it is visible the Intervall can execute your callback function wich will Trigger the next row Script.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM