import time
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from bs4 import BeautifulSoup
count = 0
driver = webdriver.Chrome(executable_path="C:\\Users\\iljal\\PycharmProjects\\google_sheets\\chromedriver")
driver.get('https://www.flashscore.ru/')
time.sleep(3) # C:\Users\iljal\PycharmProjects\google_sheets\chromedriver
arr = driver.find_elements_by_css_selector(
".event__match.event__match--scheduled.event__match--oneLine"
)
# optional (if you are not satisfied with the download speed)
driver.set_page_load_timeout(0.5)
for channel in arr:
try:
channel.click()
count += 1
if count == 17:
driver.execute_script(
"var evt = document.createEvent('MouseEvents');evt.initEvent('wheel', true, true);evt.deltaY = -100000;document.querySelector('.yamb-conversation__content').dispatchEvent(evt);")
except TimeoutException:
print("data not received. need more time in driver.set_page_load_timeout")
continue
driver.switch_to.window(driver.window_handles[arr.index(channel)+1])
link = driver.current_url
print(link)
driver.switch_to.window(driver.window_handles[0])
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.JavascriptException: Message: javascript error: Cannot read property 'dispatchEvent' of null
(Session info: chrome=83.0.4103.97)
ошибка: