Jump to content
UBot Underground

Help Stoping Loopwhile Once Condition Met


Recommended Posts

Hi,

This can be very simple for someone..

loop while($not($find regular expression(#website, #website))) {
    wait(5)
    click(<innertext="Next">, "Left Click", "No")

actually loop and click next untill it find particular regular expression..But the loop never stops even it find that regex on page..I want it to stop or break loop and move to next command..

 

plz help

Link to post
Share on other sites

i ran into that a couple times, try this

set condition no

loop while condition = no

if element exist set condition to yes

dont ask me why

but setting your loop to look for something always sems to fail

also ad a 1 sec delay before testing for condition

Link to post
Share on other sites

i ran into that a couple times, try this

set condition no

loop while condition = no

if element exist set condition to yes

dont ask me why

but setting your loop to look for something always sems to fail

also ad a 1 sec delay before testing for condition

Link to post
Share on other sites

This might look a little more complicated than what you're trying to do, but it accomplishes what stanf mentioned.  I've had the same issue before as well.  I've tackled the issue a variety of ways, but what stanf mentioned works 99% of the time.

 

All we're doing is saying

while #triggerCondition=0, Loop.

In the loop -

-we're looking for a sample of HTML using regex.

-If that sample is found, it is set as variable #regexFound

-If #regexFound contains that HTML sample

-we set #triggerCondition=1

Which halts the Loop

 

I'm sure there is a more pragmatic way to do this same thing, probably cleaner too, but that's just not my style :)

 

uBot Code below, followed by screenshot of uBot Nodes + brief step-by-step explanation.  

 

 

 

set(#triggerCondition,0,"Global")
navigate("https://ubotstudio.com/site/playground-simple-form/","Wait")

loop while(#triggerCondition = 0) {
    set(#regexFound,$find regular expression($document text,"value.*Submit"),"Global")
    if($contains(#regexFound,"value=\"Submit")) {
        then {
            set(#triggerCondition,1,"Global")
        }
        else {
            alert("Regex Not Found!  Continuing Loop...")
            stop script
        }
    }
}

 

http://i.imgur.com/qk9nyHJ.png

Link to post
Share on other sites

Try this

loop while($comparison($find regular expression(#website,#website),"!= Does not equal",$nothing)) {
    wait(5)
    click(<innertext="Next">,"Left Click","No")
}

CD

do you find that searching for the lack of nothing

works better than searching for something?

i hope my question is clear.

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