nedhulton 0 Posted June 24, 2014 Report Share Posted June 24, 2014 Please could you help me understand why the following does not work: navigate("http://www.ubotstudio.com/resources", "Wait")wait for browser event("Everything Loaded", "")set(#text, $scrape attribute(<tagname="p">, "innerhtml"), "Global")set(#text2, $eval("var example = \"{#text}\"; example;"), "Global") For whatever reason, #text2 is always blank. Quote Link to post Share on other sites
LoWrIdErTJ - BotGuru 904 Posted June 24, 2014 Report Share Posted June 24, 2014 why are you using eval? remove the eval and it wont be blank. 1 Quote Link to post Share on other sites
nedhulton 0 Posted June 24, 2014 Author Report Share Posted June 24, 2014 Works great. Thanks Quote Link to post Share on other sites
UBotDev 276 Posted June 25, 2014 Report Share Posted June 25, 2014 Text is blank because you are not escaping string that you are passing to JavaScript: http://msdn.microsoft.com/en-us/library/ie/2yfce773(v=vs.94).aspx So here is how you would do it if you need to do it via eval: set(#text2, $eval("var example = \"{$replace($replace($replace($replace(#text, $new line, "\\n"), "\\", "\\\\"), "\'", "\\\'"), "\"", "\\\"")}\"; example;"), "Global") FYI, you should also use "wait for element" instead of "wait for browser event". Quote Link to post Share on other sites
nedhulton 0 Posted July 13, 2014 Author Report Share Posted July 13, 2014 (edited) Thanks TJ for clearing up some further issues Edited July 13, 2014 by nedhulton Quote Link to post Share on other sites
Marton 48 Posted July 13, 2014 Report Share Posted July 13, 2014 To solve this specific problem with a workaround, why don't you use a simple regex with $document text or something ? p.s.: you don't need to set allow javascript to "Yes", it's on by default Marton 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.