todordonev 3 Posted May 28, 2016 Report Share Posted May 28, 2016 Hey there,The other day I was migrating a bot from ui html panel to the browser (Small interface). I had to push the contents of a table with multiple rows and columns to a JS variable in the browser. Thats where my problems started. Spent whole night debugging and wondering whats the problem turning the whole bot upside down, you know the thrill.Funny stuff because the whole problem was because of a single character. Ubot &table puts a strange new line character and Javascript does not like that character. navigate("http://www.tutorialspoint.com/html/html_tables.htm","Wait") scrape table(<(tagname="table" AND style="border-collapse: separate; border-spacing: 1px;")>,&asd) set(#test,&asd,"Global") run javascript("var test = {#test};") alert($eval("test;")) The above one will not work.. Even if you do set(#test,$replace(#test,$new line,""),"Global")Can somebody help me to&table content -> #ubot variable -> JS var Thanks,Todor. Quote Link to post Share on other sites
pash 504 Posted May 28, 2016 Report Share Posted May 28, 2016 try navigate("http://www.tutorialspoint.com/html/html_tables.htm","Wait") scrape table(<(tagname="table" AND style="border-collapse: separate; border-spacing: 1px;")>,&asd) set(#test,&asd,"Global") alert($eval("var a = {$ConverToJavascriptValue(#test)}; a;")) define $ConverToJavascriptValue(#_data) { set(#_dataOut,$replace(#_data,"\"","\\\""),"Global") set(#_dataOut,$replace regular expression(#_dataOut,"(\\r\\n|\\n)","\\r\\n"),"Global") set(#_dataOut,"\"{#_dataOut}\"","Global") return(#_dataOut) } 1 Quote Link to post Share on other sites
todordonev 3 Posted May 29, 2016 Author Report Share Posted May 29, 2016 Hey pash, thanks a lot! Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.