Здесь есть 2 фрагмента кода, первый из которых вы сделали.
Фрагмент 1:
import requests
import bs4
site = "https://www.reuters.com/companies/WDIG.DE/profile"
result = requests.get(site)
soup = bs4.BeautifulSoup(result.text, 'lxml')
with open('soup_1.txt', 'w', encoding='utf8') as f:
f.write(soup.prettify())
print(soup.find('time', {'class': 'TextLabel__text-label___3oCVw TextLabel__white___32MyF TextLabel__regular___2X0ym EventLabel-date-4_Sun'}).text)
вывод:
<time class="TextLabel__text-label___3oCVw TextLabel__white___32MyF TextLabel__regular___2X0ym EventLabel-date-4_Sun"></time>
Фрагмент 2:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("--headless")
driver = webdriver.Chrome(options=chrome_options)
driver.set_page_load_timeout(40)
driver.get(site)
soup = bs4.BeautifulSoup(driver.page_source, "html.parser")
with open('soup_2.txt', 'w', encoding='utf8') as f:
f.write(soup.prettify())
driver.quit()
print("done")
вывод:
<time class="TextLabel__text-label___3oCVw TextLabel__white___32MyF TextLabel__regular___2X0ym EventLabel-date-4_Sun">Apr 30, 2020</time>
, чтобы селен работал, вам нужно загрузить chromedriver и убедитесь, что он находится в том же месте, что и ваш скрипт.