Jump to content
UBot Underground

Looping Next List Item


Recommended Posts

Hi ubotters,

 

I am having great trouble with looping next list item but I am getting all text on same line as opposed to new line.

 

I would like to loop through each words 1 at a time until list is finished.

 

The following code shows 2 words together despite  setting new line:

ui block text("WikiWord:",#wiki_words)
clear list(%wiki_lists)
add list to list(%wiki_lists,$list from text(#wiki_words,$new line),"Delete","Global")
set list position(%wiki_lists,0)
set(#navi,"https://www.wikipedia.org/","Global")
loop($list total(%wiki_lists)) {
    navigate(#navi,"Wait")
    wait for browser event("Everything Loaded","")
    type text(<name="search">,#wiki_words,"Standard")
    wait(0.5)
    click(<class="pure-button pure-button-primary-progressive">,"Left Click","No")
    wait(5)
    navigate("{#navi}{$next list item(%wiki_lists)}","Wait")
}

Please can some one point me in the right direction to loop correctly.

 

Thanks in advance.

Link to post
Share on other sites

You are trying to search for all of the words in the box and so it will just put them together. Also, your navigate URL is slightly off. You can just go directly to the words you want. But if you want to search instead of just navigating then it will be different. If you just want to navigate you can do this:

ui block text("WikiWord:",#wiki_words)
clear list(%wiki_lists)
add list to list(%wiki_lists,$list from text(#wiki_words,$new line),"Delete","Global")
set list position(%wiki_lists,0)
set(#navi,"https://en.wikipedia.org/wiki/","Global")
loop($list total(%wiki_lists)) {
    set(#word,$next list item(%wiki_lists),"Global")
    navigate("{#navi}{#word}","Wait")
    wait for browser event("Everything Loaded","")
    wait(5)
}

Here is an example with searching instead:

ui block text("WikiWord:",#wiki_words)
clear list(%wiki_lists)
add list to list(%wiki_lists,$list from text(#wiki_words,$new line),"Delete","Global")
set list position(%wiki_lists,0)
set(#navi,"https://en.wikipedia.org/wiki/","Global")
loop($list total(%wiki_lists)) {
    set(#word,$next list item(%wiki_lists),"Global")
    navigate("https://www.wikipedia.org/","Wait")
    wait for browser event("Everything Loaded","")
    wait for element(<name="search">,"","Appear")
    type text(<name="search">,#word,"Standard")
    wait(1)
    comment("If the button exists and Wikipedia did not auto navigate us
then click the search button")
    if($exists(<class="pure-button pure-button-primary-progressive">)) {
        then {
            click(<class="pure-button pure-button-primary-progressive">,"Left Click","No")
            comment("Here is where you can add in the logic to interact with
the search results if you want")
        }
        else {
        }
    }
    wait(5)
}
Link to post
Share on other sites

 

You are trying to search for all of the words in the box and so it will just put them together. Also, your navigate URL is slightly off. You can just go directly to the words you want. But if you want to search instead of just navigating then it will be different. If you just want to navigate you can do this:

ui block text("WikiWord:",#wiki_words)
clear list(%wiki_lists)
add list to list(%wiki_lists,$list from text(#wiki_words,$new line),"Delete","Global")
set list position(%wiki_lists,0)
set(#navi,"https://en.wikipedia.org/wiki/","Global")
loop($list total(%wiki_lists)) {
    set(#word,$next list item(%wiki_lists),"Global")
    navigate("{#navi}{#word}","Wait")
    wait for browser event("Everything Loaded","")
    wait(5)
}

Here is an example with searching instead:

ui block text("WikiWord:",#wiki_words)
clear list(%wiki_lists)
add list to list(%wiki_lists,$list from text(#wiki_words,$new line),"Delete","Global")
set list position(%wiki_lists,0)
set(#navi,"https://en.wikipedia.org/wiki/","Global")
loop($list total(%wiki_lists)) {
    set(#word,$next list item(%wiki_lists),"Global")
    navigate("https://www.wikipedia.org/","Wait")
    wait for browser event("Everything Loaded","")
    wait for element(<name="search">,"","Appear")
    type text(<name="search">,#word,"Standard")
    wait(1)
    comment("If the button exists and Wikipedia did not auto navigate us
then click the search button")
    if($exists(<class="pure-button pure-button-primary-progressive">)) {
        then {
            click(<class="pure-button pure-button-primary-progressive">,"Left Click","No")
            comment("Here is where you can add in the logic to interact with
the search results if you want")
        }
        else {
        }
    }
    wait(5)
}

Hi mate,

 

thank you so much for your support. You always over deliver.

Thanks for pointing out the navigation. It was stuck in my mind to navigate in the loop then select 1x word with the New Line parameter.

 

Thanks a bunch.

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...