title: how can Sikuli be used for wait for the button untill it displayed it and then click on it?
body: <p>i m applying a sikuli skript on a webpage so that it when page loads it waits for the specific button when it appears it clicks it if not it wait for the certain time until button appears on the webpage..i have done the following script ..it works fine for 2 or three loops but after then the program stops and sikuli window appears ..here is my code.</p>
  
  <p>while exists("img1.png"):</p>
  
  <pre><code>    click("img1.png")
      wait("img2",30*60)
      click("img2.png")
      click("window close button.png") // here it closes the 2nd popup tab after clicking on img2 then it return to its page
  </code></pre>
  
  <p>where he wait tor the img1 button to appear again .. so
          wait("img1.png",30*60) 
   //this script works on 3 -4 iteration successfully but then it stops and sikuli window appears with no errors . thanks for your help</p>