aisingapore / TagUI

Free RPA tool by AI Singapore
Apache License 2.0
5.67k stars 584 forks source link

dom_result return array - use .toString() to return array object as string #729

Closed muratcim closed 4 years ago

muratcim commented 4 years ago

Hi @kensoh

i have a dom block that captures all urls on a page.Null returns when the dom_result object runs in chrome visible mode.When I run it with phantomJs or firefox, I can get the result I want

https://www.google.com
dom begin
var links = []
for (index = 0; index < document.links.length;index++)
{
  links.push(document.links[index].href)
}
return links
dom finish

echo dom_result

I researched it before I wrote it, but I couldn't find any results.

kensoh commented 4 years ago

Hi @muratcim this is a usage issue, you are trying to build an array called links and return the error to TagUI. However, you can only return string to TagUI instead of links which is a JavaScript object.

You can do it by using below instead to return as a string to process with dom_result.split(',')

return links.toString()
kensoh commented 4 years ago

Closing this issue but ping here if anything! CC @siowyisheng