steelersfan 38 Posted October 3, 2016 Report Share Posted October 3, 2016 I have written a bot that uses a list to go through a UI Block Text, shortens the input and then outputs to a different list. The problem I am having, is that the list that gets updated to, keeps returning an error and stopping the script when in headless mode. wait(1) type text(<url field>,#currentlongurl,"Standard") wait(1) click(<login button>,"Left Click","No") wait(1) add list to list(%shorturls,$scrape attribute(<class="short-url">,"href"),"Delete","Global") set(#currentshorturl,$next list item(%shorturls),"Global") increment(#currentshorturl) wait(1) The script error that this creates (only when using headless), is: "you have exceeded the range of the list" $next list item(%shorturls) -> $next list item(%shorturls) -> $next list item" I don't understand what I have done wrong, it works fine when not using headless browser. What am I doing wrong here? Quote Link to post Share on other sites
deliter 203 Posted October 4, 2016 Report Share Posted October 4, 2016 make sure you enable javascript inside in the headerless browser,also you have a 1 second wait after clicking a login button,maybe the page hasnt loaded,so use a wait for browser event instead but I think its not enabling javascript in the headless browser is the problem 1 Quote Link to post Share on other sites
steelersfan 38 Posted October 4, 2016 Author Report Share Posted October 4, 2016 make sure you enable javascript inside in the headerless browser,also you have a 1 second wait after clicking a login button,maybe the page hasnt loaded,so use a wait for browser event instead but I think its not enabling javascript in the headless browser is the problemThank you, but no it didn't work. As for the wait, prior to those commands I listed, I have a "wait for browser event". I think it has something to do with the list code. Quote Link to post Share on other sites
pash 504 Posted October 5, 2016 Report Share Posted October 5, 2016 check list count use command $list total Quote Link to post Share on other sites
steelersfan 38 Posted October 5, 2016 Author Report Share Posted October 5, 2016 check list count use command $list totalI don't understand? How do I check the list count? Quote Link to post Share on other sites
pash 504 Posted October 5, 2016 Report Share Posted October 5, 2016 I don't understand? How do I check the list count?Because you run it out of there.You need to check the total.For exampleThe actual number is 5 or 5 positions.But you want to position 10So there error "Exceeded The Range Of The List" 1 Quote Link to post Share on other sites
kate 5 Posted October 5, 2016 Report Share Posted October 5, 2016 best practice is to count total first, then do iteration ($next list item) you stated that this error occurs when using headless feature, isnt ? add list to list(%shorturls,$scrape attribute(<class="short-url">,"href"),"Delete","Global")then maybe, when using headless feature ubot failed to scrape data. Check you list if its empty 1 Quote Link to post Share on other sites
steelersfan 38 Posted October 5, 2016 Author Report Share Posted October 5, 2016 I think that is the case, there is no items in shorturls in the debugger when I run this. What can I do now? I need it to use headless, to hide actions from the end user. 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.