sacofpotatoes 0 Posted December 27, 2016 Report Share Posted December 27, 2016 Hi, I am trying to scrape a URL with $URL and set it to a particular variable, sometimes this works, however sometimes it just returns "True" when I want it to return the actual URL. any idea why this is happening? Thanks, any help is greatly appreciated,Sac Quote Link to post Share on other sites
stanf 43 Posted December 28, 2016 Report Share Posted December 28, 2016 with out seeing the codeQuestion 1. are you sure the variable is unique?Question 2. are you clearing the variable before writing to it? Quote Link to post Share on other sites
sacofpotatoes 0 Posted December 28, 2016 Author Report Share Posted December 28, 2016 The Variable is unique, and I have tried to clear the variables using the set command and just leaving what I set it to blank, it still seems to do it. I have also changed the variable to a list and then cleared the list after each loop and it seems to set the list to "True." at this point i think its something in my code that is screwing up because it not only sets the URL variable to "true" it sets another one as well. and when it does this it seems to screw up multiple things that have nothing to do with these variables. for instance after it happens it can no longer log in because it will no longer input information in the password portion of the login area while running or stepping, however if i run that portion of the code manually even after this it works fine. is there another way to clear specific variables without using "clear all data" because there are some variables that I do not want to clear. Thanks Quote Link to post Share on other sites
stanf 43 Posted December 28, 2016 Report Share Posted December 28, 2016 (edited) clear list(%what ever list name is) set(#what ever variable name is,$nothing,"Global") Edited December 28, 2016 by stanf Quote Link to post Share on other sites
stanf 43 Posted December 28, 2016 Report Share Posted December 28, 2016 if you can post the code Quote Link to post Share on other sites
sacofpotatoes 0 Posted December 28, 2016 Author Report Share Posted December 28, 2016 (edited) sure I was able to do a bit more digging, and the issue starts here set(#Random Number,$rand(3,32),"Global") wait(1) set(#Random Board,$eval($multiply(2,#Random Number)),"Global") for some reason instead of multiplying "random Number" by 2 to get "random board" it turns random board into "True" then later on it tries to scrape a URL ( which doesn't really have anything to do with that part of the code) and it also returns "True" then the only way to get it to run again is by restarting Ubot in its entirety then it will work until it does it again. Here is the second part that returns true add item to list(%UsernameURL,$url,"Don\'t Delete","Global") wait(1) set(#username1,$replace($list item(%UsernameURL,0),"https://www.pinterest.com/",""),"Global") wait(1) set(#username,$replace(#username1,"/",""),"Global") Thanks Edit: it seems to happen the second time the script goes through the loop, the first time it works fine. then the second time it tries to set the random board it sets it as "true" instead. Edited December 28, 2016 by sacofpotatoes Quote Link to post Share on other sites
stanf 43 Posted December 28, 2016 Report Share Posted December 28, 2016 i dont see aproblem with the second half====================================== set(#Random Number,$rand(3,32),"Global")wait(1)comment("loose the eval statement")set(#Random Board,$multiply(2,#Random Number),"Global")alert(#Random Board)dividerloop(1) { comment("i needed a page to goto") navigate("https://www.pinterest.com/explore/pinterest-fails/","Wait") wait for browser event("Everything Loaded","")}clear list(%UsernameURL)add item to list(%UsernameURL,$url,"Don\'t Delete","Global")wait(1)set(#username1,$nothing,"Global")set(#username1,$replace($list item(%UsernameURL,0),"https://www.pinterest.com/",""),"Global")wait(1)set(#username,$nothing,"Global")set(#username,$replace(#username1,"/",""),"Global") Quote Link to post Share on other sites
sacofpotatoes 0 Posted December 28, 2016 Author Report Share Posted December 28, 2016 Great thanks! removing the eval seemed to fix that part of the code, however its happening in a different part now, and after it happens once here, just like the last one it screws everything up and ubot needs to be restarted again before it will work. Here is the part where it is happening now. navigate(#Navigate,"Wait") wait(3) set(#Board Name,$scrape attribute(<class="boardName">,"innertext"),"Global") wait(3) click($element offset(<class="thumbImageWrapper">,1),"Left Click","No") wait(8) Specificly it happens at the set #Board name. Do you see anything wrong there? Thanks for all you help! Quote Link to post Share on other sites
stanf 43 Posted December 28, 2016 Report Share Posted December 28, 2016 i cant diagnose this because of incomplete data.1. dont know what the the variable #Navigate contains or is supposed to contain2.you are scraping data into the variable #Boardname ( i need to see the page and the code to see what is going on)3. the click command same as line 2 4. your wait times seem excessive ( if the program is moving to fast and you think these are not loaded by the time you get to them i suggest build in some test to ensure that the item has loaded before you move on---------------------------------ie.set counter =0 //this counter comes into play at the bottom of the scriptset #is the item there =no loop while #is the item there =no item exist (true/false) if item exist =truethenset #is the item there =yes else wait 1 increment counterif counter =10then alert " looped thru 10 times cant find it"stop script (this keeps looping until it finds the item or stops at 10 to prevent a runaway loop)else-----------------------------------all this does is slows the program down until the item is loaded 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.