I am attempting to locate the specific table below in the given HTML:
<table class="sidearm-table collapse-on-medium accordion" accordion-table="" sortable-table="">
<caption>Tennessee Tech<span class="hide"> - Pitching Stats</span></caption>
My approach was to find the caption, then proceed to find the parent table, from which I will iterate through the rows to find my desired text (I can accomplish this part on my own). I believe my error is buried in the fact that the caption text continues into the span tag, however not sure if this is the case. My code to do so is given below, however it continues to return None because it cannot locate the table (something with my syntax is likely incorrect):
from bs4 import BeautifulSoup
import re
import requests
header = {'User-agent' : 'Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5'}
redirect = requests.get('http://goblueraiders.com/boxscore.aspx?path=baseball&id=6117', headers = header).text
soup = BeautifulSoup(redirect, 'html.parser')
test = soup.find('caption', text = 'Tennessee Tech').find_parent('table', {'class': 'sidearm-table collapse-on-medium accordion'})