Marking off checkboxes in a table that match a specific text
Question: I have a table (screenshot below) where I want to mark off the checkboxes that
have the text "Xatu Auto Test" in the same row using selenium python.

<http://i.imgur.com/31eDDkl.png>

I've tried following these two posts:

  * [Iterating Through a Table in Selenium Very Slow](http://stackoverflow.com/questions/27234879/iterating-through-a-table-in-selenium-very-slow)
  * [Get row & column values in web table using python web driver](http://stackoverflow.com/questions/14907134/get-row-column-values-in-web-table-using-python-web-driver)

But I couldn't get those solutions to work on my code.

My code:

    
    
    form = self.browser.find_element_by_id("quotes-form")
    
    try:
        rows = form.find_elements_by_tag_name("tr")
            for row in rows:
                columns = row.find_elements_by_tag_name("td")
                for column in columns:
                    if column.text == self.group_name:
                        column.find_element_by_name("quote_id").click()
    except NoSuchElementException:
        pass
    

The checkboxes are never clicked and I am wondering what I am doing wrong.

This is the HTML when I inspect with FirePath:

    
    
    <form id="quotes-form" action="/admin/quote/delete_multiple" method="post" name="quotesForm">
        <table class="table table-striped table-shadow">
            <thead>
            <tbody id="quote-rows">
            <tr>
            <tr>
                <td class="document-column">
                <td>47</td>
                <td class="nobr">
                <td class="nobr">
                <td class="nobr">
                <td class="nobr">
                    <a title="Xatu Auto Test Data: No" href="http://192.168.56.10:5001/admin/quote/47/">Xatu Auto Test</a>
                </td>
                <td>$100,000</td>
                <td style="text-align: right;">1,000</td>
                <td class="nobr">Processing...</td>
                <td class="nobr">192.168....</td>
                <td/>
                <td>
                    <input type="checkbox" value="47" name="quote_id"/>
                </td>
            </tr>
            <tr>
        </tbody>
        <tbody id="quote-rows-footer">
    </table>
    <div class="btn-toolbar" style="text-align:center; width:100%;">
    


Answer: With a quick look, I reckon this line needs changing as you're trying to
access `column`'s `quote_id`, it should be `row`'s:

From:

    
    
    column.find_element_by_name("quote_id").click()
    

To:

    
    
    row.find_element_by_name("quote_id").click()
    

P.S. Provided that like @Saifur commented, you have your comparison done
correctly.

### Updated:

I have run a simulation and indeed the checkbox is ticked if changing `column`
to `row`, simplified version:

    
    
    from selenium import webdriver
    
    driver = webdriver.Firefox()
    driver.get('your-form-sample.html')
    form = driver.find_element_by_id("quotes-form")
    
    rows = form.find_elements_by_tag_name("tr")
    for row in rows:
        columns = row.find_elements_by_tag_name("td")
        for column in columns:
            # I changed this to the actual string provided your comparison is correct
            if column.text == 'Xatu Auto Test':
                # you need to change from column to row, and it will work
                row.find_element_by_name("quote_id").click()
    

Here's the output:

![enter image description here](http://i.stack.imgur.com/OnDLX.png)

