Jump to content
UBot Underground

Recommended Posts

Hi guys i have need to follow a timer (in this format ex. 26.1) on a web page, when the timer reaches examples to 20 seconds

should I create a "if command"...
My question is: How do I follow the timer by ubot until the condition occurs?
 
Thanks

 

Link to post
Share on other sites

Here you go, take a look at this code it might give you some ideas. 

 

ui stat monitor("Current Time: ", "{#Scrape_Timer_Min}:{#Scrape_Timer_Sec}")
ui drop down("Set Min", 04, #Min)
ui drop down("Set Sec", "10,20,30,40,50", #Sec)
ui button("Start") {
    set(#Start, $true, "Global")
    clear cookies
    navigate("http://ipadstopwatch.com/timer.html", "Wait")
    wait for browser event("Everything Loaded", "")
    click(<id="Done">, "Left Click", "No")
    wait(1)
    click(<id="Start">, "Left Click", "No")
    Scrape Time()
}
ui button("Stop") {
    set(#Start, $false, "Global")
}
define Scrape Time {
    loop while($comparison(#Start, "=", $true)) {
        set(#Scrape_Timer_Min, $scrape attribute(<id="Minutes">, "innertext"), "Global")
        set(#Scrape_Timer_Sec, $scrape attribute(<id="Seconds">, "innertext"), "Global")
        Check Statement()
    }
}
define Check Statement {
    if($comparison("{#Min}{#Sec}", ">=", "{#Scrape_Timer_Min}{#Scrape_Timer_Sec}")) {
        then {
            set(#Start, $false, "Global")
            alert("Reached Time!")
        }
        else {
        }
    }
}

 

 

Carl  ;)

Link to post
Share on other sites

Hi Carl Thanks for reply ok i have found the timer with scrapeattribute function and set a variable #Contatore

but now the problem is this when I insert the variable #contatore in the if does not recognize the value

 

set(#Contatore, $scrape attribute(<outerhtml=w"<span id=\"contatore_*\"><span class=\"*\"> * </span></span>">, "innertext"), "Global")
if($comparison(#Contatore, "<=", 25.4)) {
    then {
        click(<outerhtml=w"<input type=\"button\" id=\"*\" onclick=\"*\" value=\"Click\">">, "Left Click", "No")
    }
}

the value set on a variable #contatore is in this format:  *  (*=is a varible_value ex 25.4)

When the #contatore is called by "if command" doesn't recognize it as a numeric value because there are these characters  * 
How do I let him return only "*"?
 
Thanks
Edited by emilix85
Link to post
Share on other sites

Here you go: 

 

ui stat monitor("Current Time: ", #Scrape_Time)
ui drop down("Set Sec", "20.1,20.2,20.3", #Time)
ui button("Start") {
    set(#Start, $true, "Global")
    clear cookies
    navigate("http://www.prezzipazzi.com/prodotto/iphone-5.php?id=151953", "Wait")
    wait for browser event("Everything Loaded", "")
    Scrape Time()
}
ui button("Stop") {
    set(#Start, $false, "Global")
}
define Scrape Time {
    loop while($comparison(#Start, "=", $true)) {
        set(#Scrape_Time, $trim($scrape attribute(<class="bianco">, "innertext")), "Global")
        Check Statement()
    }
}
define Check Statement {
    if($comparison(#Time, ">=", #Scrape_Time)) {
        then {
            set(#Start, $false, "Global")
            alert("Reached Time!")
        }
        else {
        }
    }
}

 

Carl

Link to post
Share on other sites

ok thanks for your time work fine with this code:

navigate("http://www.prezzipazzi.com/prodotto/iphone-5.php?id=151953", "Wait")
set(#Contatore, $trim($scrape attribute(<outerhtml=w"<span id=\"*\"><span class=\"*\"> * </span></span>">, "innertext")), "Global")
set(#Username, $scrape attribute(<outerhtml=w"<span id=\"*\">Offerta più alta:<br>*</span>">, "innertext"), "Global")
loop while($comparison(#Contatore, ">=", 23)) {
    set(#Contatore, $trim($scrape attribute(<outerhtml=w"<span id=\"*\"><span class=\"*\"> * </span></span>">, "innertext")), "Global")
    if($comparison(#Contatore, "<=", 23)) {
        then {
            click(<id="bottone151953">, "Left Click", "No")
        }
    }
}

 

I have just 2 questions
How do I start the loopwhile everytime the site restart the timer?

I tried to insert in if two conditions:

if("{$comparison(#Contatore, "<=", 23)}&&{$comparison(#Username, "!=", "Offerta più alta:<br>emilix85")}") {
        then {
            click(<id="bottone151953">, "Left Click", "No")
        }
    }
}
but when the conditions is true don't run the command....
 
Thanks
Link to post
Share on other sites

ui stat monitor("Current Time: ", #Scrape_Time)
ui drop down("Set Sec", "20.1,20.2,20.3", #Time)
ui button("Start") {
set(#Start, $true, "Global")
clear cookies
navigate("http://www.prezzipazzi.com/prodotto/iphone-5.php?id=151953", "Wait")
wait for browser event("Everything Loaded", "")
Scrape Time()
}
ui button("Stop") {
set(#Start, $false, "Global")
}
define Scrape Time {
loop while($comparison(#Start, "=", $true)) {
set(#Scrape_Time, $trim($scrape attribute(<class="bianco">, "innertext")), "Global")
Check Statement()
}
}
define Check Statement {
if($comparison(#Time, ">=", #Scrape_Time)) {
then {
comment("Add your script between here")
click(<value="PUNTA">, "Left Click", "No")
comment("This will call the define again...")
Scrape Time()
}
else {
}
}
}

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