Disclaimer: total beginner.
This is the code snippet I'm having problems with.

```
list = []
table = driver.find_element_by_tag_name('tbody')
tr = table.find_elements_by_tag_name('tr')

for i in tr:
    if i.find_elements_by_xpath("""//a[contains(@href, 'thing1')]"""):
        name = i.find_elements_by_xpath("""//a[contains(@href, 'thing1')]""")[1]
        text = name.text
        list.append(text)

    if i.find_elements_by_xpath("""//a[contains(@href, 'thing2')]"""):
        link = i.find_element_by_xpath("""//a[contains(@href, 'thing2')]""")
        link_text = link.text
        list.append(link_text)
        address = link.get_attribute('href')
        list.append(address)

```

The html looks something like this:

```
<tbody>
   <tr>
      <a>Hit on if statement 1. Ignore.</a>
      <a>Hit on if statement 1. Always one of these tr elements.</a>
   </tr>
   <tr>
      <a>Hit on if statement 2. Tr like this could repeat n times.</a> 
   </tr>
</tbody>

```

This pattern within tbody could be repeated n times.

The first iteration of the loop works perfectly, but after that it just keeps repeating that same first iteration forever. Any help is greatly appreciated.