lkonduru
14 years agoOccasional Contributor
Page FindAll - could not return object array
Hi,
We have a page which dynamically gets rows at run-time, each row has button. I have written Jscript function which uses
Page.findAll(...) method to return array. But the property and prop value which i mention always return empty array with length 0.
Please find below the script and html elements from view source. I would really appreciate if you could help me.
Script:
function TestPage(url) {
var process, page, buttons;
process = Sys.Process("firefox")
page = process.Page("*");
page.ToUrl(url);
buttons = page.FindAll("name", "popButton"); // below
buttons = (new VBArray(buttons)).toArray();
if (buttons.length > 0) {
var i;
for (i = 0; i < buttons .length; i++) {
Log.Message("Detail: "+buttons );
}
}
else {
Log.Message("No Detail found.");
}
}
Html View Source: Can have following many submit buttons . In function, i am using "findAll("name", "popButton")
<input type="submit" class="popupScr" name="popButton" value='1001'
onkeypress="verifyKey(this,event);" onClick="javascript:NewWindow('/xxx/link.do?id=1001','popupwindow','600','500'); ">
<input type="submit" class="popupScr" name="popButton" value='1002'
onkeypress="verifyKey(this,event);" onClick="javascript:NewWindow('/xxx/link.do?id=1002','popupwindow','600','500'); ">
<input type="submit" class="popupScr" name="popButton" value='1003'
onkeypress="verifyKey(this,event);" onClick="javascript:NewWindow('/xxx/link.do?id=1003','popupwindow','600','500'); ">
Thanks
We have a page which dynamically gets rows at run-time, each row has button. I have written Jscript function which uses
Page.findAll(...) method to return array. But the property and prop value which i mention always return empty array with length 0.
Please find below the script and html elements from view source. I would really appreciate if you could help me.
Script:
function TestPage(url) {
var process, page, buttons;
process = Sys.Process("firefox")
page = process.Page("*");
page.ToUrl(url);
buttons = page.FindAll("name", "popButton"); // below
buttons = (new VBArray(buttons)).toArray();
if (buttons.length > 0) {
var i;
for (i = 0; i < buttons .length; i++) {
Log.Message("Detail: "+buttons );
}
}
else {
Log.Message("No Detail found.");
}
}
Html View Source: Can have following many submit buttons . In function, i am using "findAll("name", "popButton")
<input type="submit" class="popupScr" name="popButton" value='1001'
onkeypress="verifyKey(this,event);" onClick="javascript:NewWindow('/xxx/link.do?id=1001','popupwindow','600','500'); ">
<input type="submit" class="popupScr" name="popButton" value='1002'
onkeypress="verifyKey(this,event);" onClick="javascript:NewWindow('/xxx/link.do?id=1002','popupwindow','600','500'); ">
<input type="submit" class="popupScr" name="popButton" value='1003'
onkeypress="verifyKey(this,event);" onClick="javascript:NewWindow('/xxx/link.do?id=1003','popupwindow','600','500'); ">
Thanks