title: How to wait until element present in javascript?
body: <pre><code>(function() {
      document.evaluate('/html/body/nav/section[4]/div/form[1]/input[4]', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.click();
      Sleep(15);
      window.close();
  })();
  </code></pre>
  
  <p>So the click function works but as soon as I add the Sleep windows.close no longer works? Im stil learning Javascript so can someone help please? All I want to do is have it click the Vote Up button then Close the active tab.</p>