Reverze 0 Posted December 29, 2012 Report Share Posted December 29, 2012 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") } } Quote Link to post Share on other sites
VaultBoss 310 Posted December 29, 2012 Report Share Posted December 29, 2012 Scrape the div, adding the images (names) to a list, find the smallest there (loop while) and only click the resulting chosen one. Quote Link to post Share on other sites
Reverze 0 Posted December 29, 2012 Author Report Share Posted December 29, 2012 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 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.