B
BobRoyAce
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++) {
checkAllCheckboxesOnPage();
clickNextPageLink();
}
checkAllCheckboxesOnPage works just fine, on it's own, as does
clickNextPageLink whidh looks like follows:
function clickNextPageLink() {
alert('Going to click on Next Page link!');
nextPageLink = document.getElementById("btnNextPage");
nextPageLink.click();
}
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_ctl03"
onclick="javascript
ageMethods.UpdateSelectedRecords(this.checked,
'006303268', UpdateSelectedCount)" />
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++) {
checkAllCheckboxesOnPage();
clickNextPageLink();
}
checkAllCheckboxesOnPage works just fine, on it's own, as does
clickNextPageLink whidh looks like follows:
function clickNextPageLink() {
alert('Going to click on Next Page link!');
nextPageLink = document.getElementById("btnNextPage");
nextPageLink.click();
}
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_ctl03"
onclick="javascript
'006303268', UpdateSelectedCount)" />
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?