Sebastian Rooks 3 Posted January 18, 2016 Report Share Posted January 18, 2016 This is Ubot Day 5 for me! My first bot made a lot of progress yesterday thanks to what I've learned from this forum, now I've run into another problem I haven't been able to figure out. I'm working with Twitter. There are Javascript buttons and dropdown menus that need clicked. I'm experimenting with changing the attributes of selected elements (I don't understand best practices here). I've also experimented with using the click image option. Through a combination of those things, in a DEFINE, I can click through and it does what it's intended to do. In this case, it's to start from the account's homepage, CLICK the profile and settings icon, then CLICK view profile, then CLICK edit profile, then CLICK on Change profile picture, Then CLICK upload photo from the drop down menu. After that, it'll upload a photo from a table, but I didn't get that far yet. The problem is that when I RUN NODE on each individual node of the define, it works. But when the bot calls the custom command when running through the program, it gets a step or two into it, then fails to complete, and moves on. There are appropriate WAITs in place. I am certain that it's calling the DEFINE because it starts to work, it gets through the first step or two. How can I best debug DEFINES while it's running because it doesn't expand the custom command node to show what commands went into i? I could maybe solve my problem (poorly) by not using DEFINEs, but there's going to be a different one for each of 6 tasks, so it's going to be really difficult if I don't, and it'll really limit what I can do in the futre.. Also, I won't learn anything. Any help in the right direction will be greatly appreciated! Again, this works when run one node at a time. (Is there a better way to test run custom commands?)Does not work properly when the bot calls it. define Changeprofilepicture { click(<id="user-dropdown-toggle">,"Left Click","No") wait for element(<class="header-inner">,"","Appear") click(<class="account-summary account-summary-small js-nav">,"Left Click","No") wait($rand(#mintime,#maxtime)) wait for element(<class="UserActions-editButton edit-button btn">,"","Appear") click(<image="___IMAGE___6___IMAGE___">,"Left Click","No") wait($rand(#mintime,#maxtime)) wait for element(<class="ProfilePage-saveButton btn primary-btn">,"","Appear") click(<class="ProfileAvatarEditing-button u-boxShadowInsetUserColorHover">,"Left Click","No") wait($rand(#mintime,#maxtime)) wait for element($element offset(<name="media[]">,0),"","Appear") click(<image="___IMAGE___3___IMAGE___">,"Left Click","No")} Quote Link to post Share on other sites
HelloInsomnia 1103 Posted January 18, 2016 Report Share Posted January 18, 2016 Maybe try to scrape the buttons and such you are clicking on into variables and make sure the code is the same when the bot runs as when you step through it. 1 Quote Link to post Share on other sites
Sebastian Rooks 3 Posted January 19, 2016 Author Report Share Posted January 19, 2016 (edited) Maybe try to scrape the buttons and such you are clicking on into variables and make sure the code is the same when the bot runs as when you step through it. I tried to scrape the buttons, but I don't really understand that yet. I'm sure I'll get my head wrapped around that soon enough. Roughly 12 solid hours of trying to figure out this problem later, I got it. Turns out it had nothing to do with my code, Javascript menus, or calling the define. For some reason, sometimes, when an account logs into Twitter, and clicks the icon for the drop down menu it goes straight to settings instead of toggling the menu. Once I figured out where the problem actually was, I solved it by looping my click command while the dropdown menu did not exist, and then moving on. I feel victorious, I just may get a hang of this programming thing. Thanks for your help! Edited January 19, 2016 by Sebastian Rooks 1 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.