title: Codeception function to seeOrWaitForElement
body: <p>I've got an application which I want to test with selenium/codeception. It has a lot of ajax function which changes the pages (show/hide sections of the page) which codeception at the moment doesn't handle well.</p>
  
  <p>The problem I am having is I want to click on buttons/elements which either </p>
  
  <ul>
  <li>are already on the page       (ajax calls finished early)</li>
  <li>which are not yet on the page (waiting for ajax response)</li>
  </ul>
  
  <p>If I use <a href="http://codeception.com/docs/modules/WebDriver#waitForElement" rel="nofollow">waitForElement()</a> it only seems to works in the second case (it waits for the element to appear and continues) but if the element is already present waitForElement will timeout and fire an Fail.</p>
  
  <p>What I am looking for is a seeOrWaitForElement() function but I can't figure out how to insert logic in codeception.</p>
  
  <p>Is this function available somewhere or how can I solve this problem in another way?</p>