title: Capybara - Finding a disabled button located in table row
body: <p>I have a button </p>
  
  <pre><code>&lt;button type="button" id="saveListing" class="button small save-button" data-bind="enable: saveEnabled, click: save"&gt;&lt;i class="fa fa-save"&gt;&lt;/i&gt; Save&lt;/button&gt;
  </code></pre>
  
  <p>located in the tr of a table.</p>
  
  <p>I wrote a function for testing the button status, simply using:</p>
  
  <pre><code>And(/^...the button "(.*?)" on "(.*?)" page is disabled$/) do |button_name, page|
  
    button_id = ConfigHelper.get_button_info(button_name, page)['id']
    button_class = ConfigHelper.get_button_info(button_name, page)['class']
  
    if !button_id.nil?
      find_button(button_id)[:disabled].should eq 'true'
    elsif !button_class.nil?
      find(button_class)[:disabled].should eq 'true'
    else
      button_text = ConfigHelper.get_button_info(button_name, page)['text']
      find('button', text: button_text)[:disabled].should eq "true"
    end
  end
  </code></pre>
  
  <p>However, this block does not work for a button in a table row. I also tried add checking by button id, and it also did not work. How can I implement it without taking table id as a parameter? (As I don't want to write table id inside the feature)</p>
  
  <p>When using id, the error is:</p>
  
  <pre><code>Capybara::ElementNotFound: Unable to find css ".saveListing"
  </code></pre>
  
  <p>or using text:</p>
  
  <pre><code> Ambiguous match, found 4 elements matching css "button" (Capybara::Ambiguous)
  </code></pre>
  
  <p>Thanks.</p>