python main.py > file.txt
tail -f file.txt | grep Hello
import time
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(ChromeDriverManager(version="87.0.4280.88").install())
driver.get('https://m.ru.investing.com/commodities/us-corn-advanced-chart')
time.sleep(15)
def reqursive_nested_iframe(driver):
iframes = driver.find_elements_by_tag_name('iframe')
for n, iframe in enumerate(iframes):
print(n, iframe.get_attribute("src"))
if 'https://tvc' in iframe.get_attribute("src"):
driver.switch_to.frame(n)
reqursive_nested_iframe(driver)
time.sleep(5)
try:
reqursive_nested_iframe(driver)
except:
pass
print(driver.find_element_by_css_selector("div.pane-legend").text)
Фьючерс на кукурузу США, 15, (CFD)ОТКР463.90МАКС463.90МИН463.60ЗАКР463.62
А вы из каких соображений сначала написали None, а потом заменили на infinity?
:)