Files
kis_trader/scratch/check_bs4.py

24 lines
662 B
Python

from bs4 import BeautifulSoup
import sys
with open("templates/backtest.html", "r", encoding="utf-8") as f:
html = f.read()
soup = BeautifulSoup(html, "html.parser")
tab = soup.find(id="tab-tail")
if not tab:
print("tab-tail not found!")
sys.exit(1)
print("tab-tail children count:", len(list(tab.children)))
card = tab.find(class_="card")
if card:
print("card found in tab-tail")
print("card text length:", len(card.text))
else:
print("card NOT found in tab-tail!")
# Print the IDs of all tabs to see if any are swallowed
tabs = soup.find_all(id=lambda x: x and x.startswith("tab-"))
print("Found tabs:", [t.get('id') for t in tabs])