Welcome Guest Search | Active Topics | Sign In | Register

Make array of all elements and return to vb.net Options
Ioannis
Posted: Tuesday, May 17, 2016 2:55:26 PM
Rank: Newbie
Groups: Member

Joined: 5/13/2016
Posts: 5
I am trying to list all of the elements on a website for a autofill feature.

One of the first steps is to list all of the elements that a user can interface with. So it is important to look at each element.

I would like to return a 2-dimensional array to vb.net, how can I implement this javascript code with evalscript to return the array?

Quote:

if (document.all !== undefined) {
allElements = document.all;
} Else {
allElements = document.getElementsByTagName("*");
}

var myArr = new Array();
var r = 0;

for (var i=0, max=allElements.length; i < max; i++) {

switch (allElements[i].nodeType) {
case "a": myArr[r] = new Array(allElements[i].nodeType,allElements[i].getAttribute("href"));
case "button": myArr[r] = new Array(allElements[i].nodeType,allElements[i].getAttribute("href"));

}

r++

}

return myArr;
eo_support
Posted: Tuesday, May 17, 2016 3:45:36 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

Your code looks fine. You can just put it in a function and then call EvalScript("your_function_name()") and it should work. The function should return a JSArray object back to you.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.