You can select elements between two nodes in BeautifulSoup by looping through the main nodes, and checking the next siblings to see if a main node was reached:
from bs4 import BeautifulSoup
html_content = '''
Element 1
Element 2
Element 3
'''
soup = BeautifulSoup(html_content, 'html.parser')
elements = []
for tag in soup.find("h1").next_siblings:
if tag.name == "h1":
break
else:
elements.append(tag)
print(elements)
# Output: [Element 1
, Element 2
, Element 3
]
