Im scraping data from a page.
Using UiPath’s table extraction activity it works but its quite slow. I played around with JavaScript and notice its a lot faster but how do i convert the result to a datatable??
Thanks
B.Singh
Im scraping data from a page.
Using UiPath’s table extraction activity it works but its quite slow. I played around with JavaScript and notice its a lot faster but how do i convert the result to a datatable??
Thanks
B.Singh
@bs113256
something like this
function e(){
//get all the rows
msgList = document.getElementById("messages-list")
boxes = msgList.querySelectorAll('[id^="content"]:not([hidden])')
dictJoined = "";
//loop all rows
for (let i = 0; i < boxes.length; i++) {
var dict = {};
dict["field1"] = "test1";
dict["field2"] = "test2";
if (dictJoined === ""){
dictJoined = JSON.stringify(dict);
} else {
dictJoined = dictJoined + "," + JSON.stringify(dict);
}
}
return "["+dictJoined+"]";
}
this will return a string that looks something like this
[{"field1":"result1","field2":"result2"},{"field1":"result1","field2":"result2"}]
now use
newtonsoft.json.jsonconvert.deserializeObject(of datatable)(javascriptResult)
to convert the result to a datatable!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.