Since this is BeautifulSoup
specific question, here is a working BeautifulSoup
specific solution. The idea is to find the element having the SKU#
text and locate the first table
parent:
import requests
from bs4 import BeautifulSoup
data = requests.get('http://epi.hbsna.com/products/dept.asp?msi=0&sid=6076533CE8C648AE9883BDDBED795B29&dept_id=315&parent_id=0').content
soup = BeautifulSoup(data, "html.parser")
table = soup.find(text="SKU#").find_parent("table")
for row in table.find_all("tr")[1:]:
print([cell.get_text(strip=True) for cell in row.find_all("td")])
Prints the contents of the table:
['40010001', 'ABA Service Kit', '-', '1-1/4" 10', 'None', '5-1/2"', '0.63', 'Clamp', '42710566']
['40010002', 'ABA Service Kit', '-', '1-1/4" 10', '5/8" RH', '5-1/2"', '0.63', 'Clamp', '42710566']
...
['40010649', 'ABA Service Kit', '-', '1 1/2 - 10', '1.5', '6"', '0.50', 'Strap', '427-10517']
['40050604', 'ABA Service Kit', 'none', '1 1/2" - 10"', '1 1/2" LH', '6"', '0.50', 'Strap', '427-10601']