title: Can't click a web button with webdriverio
body: <p>I'm trying to learn automation with webdriverio in nodejs right now, with admittedly not the most knowledge of jquery in HTML. here's where I am:</p>
  
  <p>I've wrote a script that, so far successfully logs me in to an account and navigates to the page I want. My goal is to make a reservation- but when I click a reservation item, a pop up window appears with some pre-loaded data and the "make reservation" button, which on click runs a javascript function. However, I haven't been able to successfully recreate an actual click.. </p>
  
  <p>The HTML of the button looks like this:</p>
  
  <pre><code>&lt;div class="inside"&gt;
              &lt;ul class="toolBtns"&gt;
  
                  &lt;li id="ctl00_ctrl_MakeBookingTime_liCancelChanges" class="cancelChanges"&gt;
                      &lt;a id="ctl00_ctrl_MakeBookingTime_lbCancelChanges" href="javascript:__doPostBack('ctl00$ctrl_MakeBookingTime$lbCancelChanges','')"&gt;Discard Changes&lt;/a&gt;&lt;/li&gt;
                  &lt;li id="ctl00_ctrl_MakeBookingTime_liBook" class="bookRes"&gt;
                      &lt;a id="ctl00_ctrl_MakeBookingTime_lbBook" href="javascript:__doPostBack('ctl00$ctrl_MakeBookingTime$lbBook','')"&gt;Make Reservation&lt;/a&gt;&lt;/li&gt;
              &lt;/ul&gt;               
          &lt;/div&gt;
  </code></pre>
  
  <p>Thus far, I've tried to click it using this (this is the code after my "client" declaration)</p>
  
  <pre><code>  .execute(executeFunction).then(function(resp){
    console.log('execute function status:',resp.state) // should log true if element is there
  })
  .waitForExist('#ctl00_ctrl_MakeBookingTime_lbBook').then(function(exists){
    console.log('button exists status:',exists.state) // should log true if element is there
  })
  .elements('#ctl00_ctrl_MakeBookingTime_lbBook').then(function(resp){
      console.log('element found status: ',resp);
    return; //wait for the popup to load before executing the click
  }).click('=Make Reservation') //this is the line that doesn't seem to work
  </code></pre>
  
  <p>that last line is the one that doesn't work. As you see I'm using a regex as the query element, but i've also tried just the item ID directly as suggested <a href="https://stackoverflow.com/questions/12414174/selecting-elements-in-webdriver">here</a>. I've also tried to manually execute the javascript function in the HREF link, but that just dismissess the window without actually making the reservation:</p>
  
  <pre><code>.execute("javascript:__doPostBack('ctl00$ctrl_MakeBookingTime$lbBook")
  </code></pre>
  
  <p>I am guessing there are some params in _doPostBack function which I'm not understanding.. </p>
  
  <p>Any suggestions or links to other articles would be very helpful. I've be scouring for hours and can't quite figure it out. Thanks!</p>
  
  <h2>Update</h2>
  
  <p>: ChristianB requested for logs, here they are:</p>
  
  <pre><code>2:32:16.747 INFO - Done: [execute script: javascript:LaunchLockedReserver(this,event,'54','200','12/19/2015','9:15 AM','2');, []]
  12:32:16.752 INFO - Executing: [find elements: By.xpath: //*[contains(@id, "ctl00_ctrl_MakeBookingTime_lbBook") and contains(., "Make Reservation")]])
  12:32:16.766 INFO - Done: [find elements: By.xpath: //*[contains(@id, "ctl00_ctrl_MakeBookingTime_lbBook") and contains(., "Make Reservation")]]
  12:32:17.023 INFO - Executing: [find elements: By.xpath: //*[contains(@id, "ctl00_ctrl_MakeBookingTime_lbBook") and contains(., "Make Reservation")]])
  12:32:17.038 INFO - Done: [find elements: By.xpath: //*[contains(@id, "ctl00_ctrl_MakeBookingTime_lbBook") and contains(., "Make Reservation")]]
  12:32:17.303 INFO - Executing: [find elements: By.xpath: //*[contains(@id, "ctl00_ctrl_MakeBookingTime_lbBook") and contains(., "Make Reservation")]])
  12:32:17.303 INFO - Executing: [find element: By.xpath: //*[contains(@id, "ctl00_ctrl_MakeBookingTime_lbBook") and contains(., "Make Reservation")]])
  12:32:17.311 INFO - Done: [find elements: By.xpath: //*[contains(@id, "ctl00_ctrl_MakeBookingTime_lbBook") and contains(., "Make Reservation")]]
  12:32:17.568 WARN - Exception thrown
  org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//*[contains(@id, "ctl00_ctrl_MakeBookingTime_lbBook") and contains(., "Make Reservation")]"}
  </code></pre>
  
  <p>It seems the last piece isn't working. Thanks for pointing me to the logs. What's odd is that when I change the regex to just the ID directly, it still gives that error:</p>
  
  <pre><code>12:38:33.483 WARN - Exception thrown
  org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"id","selector":"ctl00_ctrl_MakeBookingTime_lbBook"}
  </code></pre>
  
  <p>I'll keep trying and checking the logs</p>
  
  <h2>Update #2</h2>
  
  <p>I put in logging into the .then functions for each of functions I run (see the updated code above) and the .waitForExists function never seems to even be run. My console output after running the function looks like this: </p>
  
  <pre><code>execute function status: success
  Error: element (#ctl00_ctrl_MakeBookingTime_lbBook) still not existing after 500ms
  at elements("#ctl00_ctrl_MakeBookingTime_lbBook") - isExisting.js:43:17
  at isExisting("#ctl00_ctrl_MakeBookingTime_lbBook") - waitForExist.js:31:21
  </code></pre>
  
  <p>Basically it seems to go from the .execute straight to the .elements function... </p>