I have a website for which I am trying to automate interactions with.
The first page shows the first page of results of a search, each
result having a checkbox next to it.
In addition, I have code that performs two steps:
1) checks all checkboxes on the page, and
2) clicks on a link to go to the next page of results.
I also have code that uses a loop to perform these steps over and over
again, say 100 times. If I throw up an alert each time, before step
2, all works fine. However, if I don't, it doesn't work. The code for
the loop looks like follows:
for (var iPage = 1; iPage < 10; iPage++) {
checkAllCheckbo xesOnPage();
clickNextPageLi nk();
}
checkAllCheckbo xesOnPage works just fine, on it's own, as does
clickNextPageLi nk whidh looks like follows:
function clickNextPageLi nk() {
alert('Going to click on Next Page link!');
nextPageLink = document.getEle mentById("btnNe xtPage");
nextPageLink.cl ick();
}
As long as I have that alert in there, it works. But, without it, it
doesn't. I'm assuming it's because the alert results in just enough of
a delay to let things work.
It should be noted that there is javascript on the page that runs in
the onclick event for each checkbox. An example follows:
<input name="dgSelect$ ctl03" type="checkbox" id="dgSelect_ct l03"
onclick="javasc ript:PageMethod s.UpdateSelecte dRecords(this.c hecked,
'006303268', UpdateSelectedC ount)" />
Lastly, just FYI, I am using Chickenfoot interface, in Firefox, to run
the script, by inserting a button on the page that runs my script.
Any ideas as to what I could change to make this work without an
alert?
The first page shows the first page of results of a search, each
result having a checkbox next to it.
In addition, I have code that performs two steps:
1) checks all checkboxes on the page, and
2) clicks on a link to go to the next page of results.
I also have code that uses a loop to perform these steps over and over
again, say 100 times. If I throw up an alert each time, before step
2, all works fine. However, if I don't, it doesn't work. The code for
the loop looks like follows:
for (var iPage = 1; iPage < 10; iPage++) {
checkAllCheckbo xesOnPage();
clickNextPageLi nk();
}
checkAllCheckbo xesOnPage works just fine, on it's own, as does
clickNextPageLi nk whidh looks like follows:
function clickNextPageLi nk() {
alert('Going to click on Next Page link!');
nextPageLink = document.getEle mentById("btnNe xtPage");
nextPageLink.cl ick();
}
As long as I have that alert in there, it works. But, without it, it
doesn't. I'm assuming it's because the alert results in just enough of
a delay to let things work.
It should be noted that there is javascript on the page that runs in
the onclick event for each checkbox. An example follows:
<input name="dgSelect$ ctl03" type="checkbox" id="dgSelect_ct l03"
onclick="javasc ript:PageMethod s.UpdateSelecte dRecords(this.c hecked,
'006303268', UpdateSelectedC ount)" />
Lastly, just FYI, I am using Chickenfoot interface, in Firefox, to run
the script, by inserting a button on the page that runs my script.
Any ideas as to what I could change to make this work without an
alert?
Comment