Jump to content
UBot Underground

Recommended Posts

Hey there! Newby ubot fan here.

I'm wondering why I'm getting this  error. I'd say I'm correctly using "set list position" which is supposed to reset my list in a loop when using the "next list item". 

Any idea?

 

My script so far:

clear cookies
allow javascript("Yes")
clear table(&tablacostosenvio)
add list to list(%urls, $list from file("urls-looma.txt"), "Delete", "Global")
clear list(%codigospostales)
add list to list(%codigospostales, $list from file("codigospostales.txt"), "Delete", "Global")
set list position(%codigospostales, 0)
loop($list total(%urls)) {
    navigate($next list item(%urls), "Wait")
    wait for browser event("Everything Loaded", "")
    type text(<zip code field>, $next list item(%codigospostales), "Standard")
    click(<id="calculate-shipping-button">, "Left Click", "No")
    wait(15)
    add item to list(%retiroensucursal, $scrape attribute(<outerhtml=w"<h4>*</h4>">, "innertext"), "Delete", "Global")
    add list to table as column(&tablacostosenvio, 1, 0, %urls)
    add list to table as row(&tablacostosenvio, 0, 1, %codigospostales)
    add list to table as row(&tablacostosenvio, 1, 1, %retiroensucursal)
}
save to file("tablacostodeenvio.csv", &tablacostosenvio)

Link to post
Share on other sites

Hey,

 

Im not very good at debugging without working with the script

 

is codigospostales at least the same length as the list urls

I have just edited your code so that you can actually see which loop number you are on now,the next list item is not really recommended for debugging,sometimes I know when you do exceed a list it can cause the whole program to crash and you need to exit the application,so I have added some ui stat monitors,so you know exactly what number the lists are on etc

 

 

ui stat monitor("urls list total",$list total(%urls))
ui stat monitor("codigospostales list total",$list total(%codigospostales))
ui stat monitor("position of loop",#position)
clear cookies
allow javascript("Yes")
clear table(&tablacostosenvio)
add list to list(%urls,$list from file("urls-looma.txt"),"Delete","Global")
clear list(%codigospostales)
add list to list(%codigospostales,$list from file("codigospostales.txt"),"Delete","Global")
set list position(%codigospostales,0)
set(#position,0,"Global")
loop($list total(%urls)) {
    navigate($list item(%urls,#position),"Wait")
    wait for browser event("Everything Loaded","")
    type text(<zip code field>,$list item(%codigospostales,#position),"Standard")
    click(<id="calculate-shipping-button">,"Left Click","No")
    wait(15)
    add item to list(%retiroensucursal,$scrape attribute(<outerhtml=w"<h4>*</h4>">,"innertext"),"Delete","Global")
    add list to table as column(&tablacostosenvio,1,0,%urls)
    add list to table as row(&tablacostosenvio,0,1,%codigospostales)
    add list to table as row(&tablacostosenvio,1,1,%retiroensucursal)
    increment(#position)
}
save to file("tablacostodeenvio.csv",&tablacostosenvio)

Link to post
Share on other sites

Hey deliter, thanks you so much for your answer. Unfortunately with the suggested modifications I get the same error.
The list codigospostales is shorter than the list url.

I need the bot to visit each url from the list %url and extract the shipment cost related to each zip code from the list %codigospostales.

Thanks!

Link to post
Share on other sites

that is the problem

 

the codigospostales list,will eventually run out of items,since it is shorter than the amount of loops(the list total of urls) ,so Ive made an adjustment to reset the list position of codigospostales to zero when it has reached its max,below

 

You want to navigate to each url,and then check the shipping costs for each post code so below this code I have a code that should do that,it will loop the total of urls,and do a further loop of every item inside codigopostales 

 

ui stat monitor("urls list total",$list total(%urls))
ui stat monitor("codigospostales list total",$list total(%codigospostales))
ui stat monitor("position of loop",#position)
clear cookies
allow javascript("Yes")
clear table(&tablacostosenvio)
add list to list(%urls,$list from file("urls-looma.txt"),"Delete","Global")
clear list(%codigospostales)
add list to list(%codigospostales,$list from file("codigospostales.txt"),"Delete","Global")
set list position(%codigospostales,0)
set(#position,0,"Global")
loop($list total(%urls)) {
    set(#codigospostales Position,0,"Global")
    loop($list total(%codigospostales)) {
        navigate($list item(%urls,#position),"Wait")
        wait for browser event("Everything Loaded","")
        type text(<zip code field>,$list item(%codigospostales,#codigospostales Position),"Standard")
        click(<id="calculate-shipping-button">,"Left Click","No")
        wait(15)
        add item to list(%retiroensucursal,$scrape attribute(<outerhtml=w"<h4>*</h4>">,"innertext"),"Delete","Global")
        add list to table as column(&tablacostosenvio,1,0,%urls)
        add list to table as row(&tablacostosenvio,0,1,%codigospostales)
        add list to table as row(&tablacostosenvio,1,1,%retiroensucursal)
        increment(#codigospostales Position)
    }
    increment(#position)
}
save to file("tablacostodeenvio.csv",&tablacostosenvio)

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...