title: waiting for the page to load nonangular site
body: <p>my tests are working ...sort of...
  the issue is that some times this finds the elements and sometime it doesn't. I am assuming that the page is loading a little later. I need to add some kind of wait time. I am not sure how would that work with non-angular site</p>
  
  <p>here is the part that works...hmm about 50% of the time</p>
  
  <pre><code>browser.driver.findElement(By.xpath("//button[.='Log In']")).submit();
  </code></pre>
  
  <p>here is what I tried to do</p>
  
  <pre><code>        browser.driver.wait(function() {
              expect(browser.driver.findElement(By.xpath("//button[.='Log In']"))).isPresent().toBe(true);
          });
          browser.driver.findElement(By.xpath("//button[.='Log In']")).submit();
  </code></pre>
  
  <p>here is the stack that I get</p>
  
  <pre><code>Using the selenium server at http://localhost:4444/wd/hub
  A Jasmine spec timed out. Resetting the WebDriver Control Flow.
  The last active task was: 
  WebDriver.sleep(50000)
      at [object Object].webdriver.promise.ControlFlow.timeout (/Library/WebServer/Documents/youman/test/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1358:15)
      at [object Object].webdriver.WebDriver.sleep (/Library/WebServer/Documents/youman/test/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:600:21)
      at [object Object].&lt;anonymous&gt; (/Library/WebServer/Documents/youman/test/spec/craiglist.js:56:24)
      at /Library/WebServer/Documents/youman/test/node_modules/protractor/node_modules/jasminewd/index.js:94:14
      at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (/Library/WebServer/Documents/youman/test/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1640:20)
      at [object Object].webdriver.promise.ControlFlow.runEventLoop_ (/Library/WebServer/Documents/youman/test/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1505:8)
      at [object Object].wrapper [as _onTimeout] (timers.js:252:14)
      at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
  F
  
  Failures:
  
    1) Craigslist automation should greet the named user
     Message:
       timeout: timed out after 10000 msec waiting for spec to complete
     Stacktrace:
       undefined
  
  Finished in 11.073 seconds
  1 test, 2 assertions, 1 failure
  
  Asims-MacBook-Air:test asimzaidi$ ./node_modules/.bin/protractor  protractor.conf.js
  Using the selenium server at http://localhost:4444/wd/hub
  F
  
  Failures:
  
    1) Craigslist automation should greet the named user
     Message:
       Error: expect called with WebElement argument, expected a Promise. Did you mean to use .getText()?
     Stacktrace:
       Error: expect called with WebElement argument, expected a Promise. Did you mean to use .getText()?
      at Error (&lt;anonymous&gt;)
  ==== async task ====
      at [object Object].&lt;anonymous&gt; (/Library/WebServer/Documents/youman/test/spec/mytest.js:56:24)
  ==== async task ====
  Asynchronous test function: it()
  Error
      at [object Object].&lt;anonymous&gt; (/Library/WebServer/Documents/youman/test/spec/craiglist.js:13:5)
      at Object.&lt;anonymous&gt; (/Library/WebServer/Documents/youman/test/spec/mytest.js:10:1)
  
  Finished in 9.707 seconds
  </code></pre>