I am web scraping a website with Python selenium. This is the code on the website:
and I'd like texts to look like shown on the website, i.e. easy to 'read' with line breaks, in an organized format.
I tried using
driver.find_element_by_class_name('record-content.record-information.record-content_j').text
but there are \n \n characters inside. I tried print(text), and looks better. But is there a way to store the text in a dataframe or something so it is saved in an organized format.
The website looks like this:
When I tried
rawData=driver.find_element_by_class_name('record-content.record-information.record-content_j').text
sanitizedData = rawData.replace('\n','')
print(BeautifulSoup(sanitizedData, 'html.parser').prettify())
The output looks like this:

