Jump to content
UBot Underground

Problem clicking images with same name


Recommended Posts

Probably this is some stupid question but I can't figure out what I'm doing wrong.

 

I have this div:

 

______________________________________________________________________________________________________________________________________

<div id="gta2" style="display:none;">
                                            <div class="dcities" style="display:none;width:400px;height:60px;background-image:url('brazil_1.png');" id="city1">
                                                <img src="a_2.png" style="margin-top:30px;margin-right:232px;border:1px solid #aaa;">
                                            </div>
                                            <div class="dcities" style="display:none;width:400px;height:60px;background-image:url('brazil_2.png');" id="city2">
                                                <img src="a_4.png" style="margin-top:30px;margin-right:232px;border:1px solid #aaa;">
                                            </div>
                                            <div class="dcities" style="display:none;width:400px;height:60px;background-image:url('brazil_3.png');" id="city3">
                                                <img src="a_2.png" style="margin-top:30px;margin-right:232px;border:1px solid #aaa;">
                                            </div>
                                            <div style="padding-top:30px;padding-bottom:30px;"></div>
                                        </div>

______________________________________________________________________________________________________________________________________

 

It's all about the 3 png images in bold, they can vary from a_0.png to a_4.png.

The goal is to click the image with the lowest number in it, but as you can see in the example there can be more images with the same number.

I thought I had the solution in the code you see below, but for some reason it isn't clicking one of the images.

Is there anybody that can tell me what I'm doing wrong?

 

    if($exists(<outerhtml=w"<div cityid=\"1\" id=\"city1\" class=\"cities\"*<img src=\"a_0.png\"*
                                            </div>">)) {
        then {
            click(<id="city1">, "Left Click", "No")
        }
    }
    else if($exists(<outerhtml=w"<div cityid=\"2\" id=\"city2\" class=\"cities\"*<img src=\"a_0.png\"*
                                            </div>">)) {
        then {
            click(<id="city2">, "Left Click", "No")
        }
    }
    else if($exists(<outerhtml=w"<div cityid=\"3\" id=\"city3\" class=\"cities\"*<img src=\"a_0.png\"*
                                            </div>">)) {
        then {
            click(<id="city3">, "Left Click", "No")
        }
    }
    else if($exists(<outerhtml=w"<div cityid=\"1\" id=\"city1\" class=\"cities\"*<img src=\"a_1.png\"*
                                            </div>">)) {
        then {
            click(<id="city1">, "Left Click", "No")
        }
    }
    else if($exists(<outerhtml=w"<div cityid=\"2\" id=\"city2\" class=\"cities\"*<img src=\"a_1.png\"*
                                            </div>">)) {
        then {
            click(<id="city2">, "Left Click", "No")
        }
    }
    else if($exists(<outerhtml=w"<div cityid=\"3\" id=\"city3\" class=\"cities\"*<img src=\"a_1.png\"*
                                            </div>">)) {
        then {
            click(<id="city3">, "Left Click", "No")
        }
    }
    else if($exists(<outerhtml=w"<div cityid=\"1\" id=\"city1\" class=\"cities\"*<img src=\"a_2.png\"*
                                            </div>">)) {
        then {
            click(<id="city1">, "Left Click", "No")
        }
    }
    else if($exists(<outerhtml=w"<div cityid=\"2\" id=\"city2\" class=\"cities\"*<img src=\"a_2.png\"*
                                            </div>">)) {
        then {
            click(<id="city2">, "Left Click", "No")
        }
    }
    else if($exists(<outerhtml=w"<div cityid=\"3\" id=\"city3\" class=\"cities\"*<img src=\"a_2.png\"*
                                            </div>">)) {
        then {
            click(<id="city3">, "Left Click", "No")
        }
    }
    else if($exists(<outerhtml=w"<div cityid=\"1\" id=\"city1\" class=\"cities\"*<img src=\"a_3.png\"*
                                            </div>">)) {
        then {
            click(<id="city1">, "Left Click", "No")
        }
    }
    else if($exists(<outerhtml=w"<div cityid=\"2\" id=\"city2\" class=\"cities\"*<img src=\"a_3.png\"*
                                            </div>">)) {
        then {
            click(<id="city2">, "Left Click", "No")
        }
    }
    else if($exists(<outerhtml=w"<div cityid=\"3\" id=\"city3\" class=\"cities\"*<img src=\"a_3.png\"*
                                            </div>">)) {
        then {
            click(<id="city3">, "Left Click", "No")
        }
    }
    else if($exists(<outerhtml=w"<div cityid=\"1\" id=\"city1\" class=\"cities\"*<img src=\"a_4.png\"*
                                            </div>">)) {
        then {
            click(<id="city1">, "Left Click", "No")
        }
    }
    else if($exists(<outerhtml=w"<div cityid=\"2\" id=\"city2\" class=\"cities\"*<img src=\"a_4.png\"*
                                            </div>">)) {
        then {
            click(<id="city2">, "Left Click", "No")
        }
    }
    else if($exists(<outerhtml=w"<div cityid=\"3\" id=\"city3\" class=\"cities\"*<img src=\"a_4.png\"*
                                            </div>">)) {
        then {
            click(<id="city3">, "Left Click", "No")
        }
    }

Link to post
Share on other sites

Thanks for your answer VaultBoss!

 

That might be a solution but I'm still a big newbie with ubot and I don't know to do that.

But if you have a look at my code, what is going wrong there because I was pretty sure it would work :(

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