I need to manipulate an Intranet web site with Javascript and I’ve achieved the next capabilities which work nicely, but when I run them one after the other:
1: operate ()
var checklist = doc.getElementsByName("filter");
for (var i=0; i<checklist.size; i++) checklist[i].click on();
,
2: operate ()
var checklist = doc.getElementsByClassName("ui-icon ui-icon-pencil tiptip");
for (var i=0; i<checklist.size; i++) checklist[i].click on();
,
3: operate ()
for(var i = 0, len = doc.hyperlinks.size; i < len; i += 1)
if(doc.hyperlinks[i].textContent === "Configuration ")
doc.hyperlinks[i].click on();
,
4: operate ()
var x = doc.getElementsByName("configurations[]");
var i;
for (i = 0; i < x.size; i++)
if (x[i].kind == "checkbox")
x[i].checked = true;
,
My aim is to launch all of the capabilities directly however I’ve to attend for the web page to load earlier than making the second click on then the third then the fourth.
with the next code I’ve to run my operate 4 occasions to get the 4 clicks
operate ()
//operate 1
var checklist = doc.getElementsByName("filter");
for (var i=0; i<checklist.size; i++) checklist[i].click on();
//operate 2
var checklist = doc.getElementsByClassName("ui-icon ui-icon-pencil tiptip");
for (var i=0; i<checklist.size; i++) checklist[i].click on();
//operate 3
for(var i = 0, len = doc.hyperlinks.size; i < len; i += 1)
if(doc.hyperlinks[i].textContent === "Configuration ")
doc.hyperlinks[i].click on();
//operate 4
var x = doc.getElementsByName("configurations[]");
var i;
for (i = 0; i < x.size; i++)
if (x[i].kind == "checkbox")
x[i].checked = true;
,
the strategy
`setTimeout(() =>
var checklist = doc.getElementsByName("filter");
for (var i=0; i<checklist.size; i++) checklist[i].click on();
, 3000)
setTimeout(() =>
var checklist = doc.getElementsByClassName("ui-icon ui-icon-pencil tiptip");
for (var i=0; i<checklist.size; i++) checklist[i].click on();
, 3000)`
and the strategy
doc.addEventListener("DOMContentLoaded", () =>
var checklist = doc.getElementsByName("filter");
for (var i=0; i<checklist.size; i++) checklist[i].click on();
);
doc.addEventListener("DOMContentLoaded", () =>
var checklist = doc.getElementsByClassName("ui-icon ui-icon-pencil tiptip");
for (var i=0; i<checklist.size; i++) checklist[i].click on();
);
Additionally don’t work, You probably have any concept please i shall be grateful.