mport time
import json
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options

executable_path = 'C:\ChromeDriver\chromedriver.exe'

def create_chrome_driver(executable_path):
    service = Service(executable_path)
    options = Options()

    # Установка требуемых опций браузера
    options.add_argument('--start-maximized')  # Пример опции

    driver = webdriver.Chrome(service=service, options=options)
    return driver

#executable_path = '/путь/к/драйверу/chromedriver.exe'

def save_page_html(driver, url, file_name):
    driver.get(url)
    time.sleep(10) # Дайте странице время для загрузки и рендеринга

    # Извлечение актуального HTML-кода с помощью Chrome DevTools Protocol
    performance_log = driver.get_log('performance')
    events = [json.loads(entry['message'])['message'] for entry in performance_log]
    html = ''
    for event in events:
        if 'method' in event and event['method'] == 'Network.responseReceived':
            response = event['params']['response']
            if response['mimeType'] == 'text/html':
                response_url = response['url']
                if response_url == url:
                    request_id = event['params']['requestId']
                    html_response = driver.execute_cdp_cmd('Network.getResponseBody', {'requestId': request_id})
                    html = html_response['body']
                    break

    driver.quit()

    with open(file_name, 'w', encoding="utf-8") as file:
        file.write(html)


start = time.time()
driver = create_chrome_driver(executable_path)

save_page_html(driver, 'https://www.playscores.com/scanner-futebol-online/ao-vivo', 'rendered_page.html')
end = time.time() - start

print(end) Этот код выдает ошибку Message: invalid argument: log type 'performance' not found (Session info: chrome=115.0.5790.102) Stacktrace: Backtrace: GetHandleVerifier [0x00007FF6DABA3E62+57250] (No symbol) [0x00007FF6DAB1BC02] (No symbol) [0x00007FF6DA9EE0BB] (No symbol) [0x00007FF6DAA5414C] (No symbol) [0x00007FF6DAA46770] (No symbol) [0x00007FF6DAA1CC71] (No symbol) [0x00007FF6DAA1DE54] GetHandleVerifier [0x00007FF6DAE54CF2+2879026] GetHandleVerifier [0x00007FF6DAEA6F30+3215472] GetHandleVerifier [0x00007FF6DAE9FD4F+3186319] GetHandleVerifier [0x00007FF6DAC35505+652869] (No symbol) [0x00007FF6DAB27518] (No symbol) [0x00007FF6DAB235F4] (No symbol) [0x00007FF6DAB236EC] (No symbol) [0x00007FF6DAB138E3] BaseThreadInitThunk [0x00007FFF7FAB7614+20] RtlUserThreadStart [0x00007FFF810826F1+33] 
File "C:\Users\MP\Documents\MP_sandbox\WZPV4", line 29, in save_page_html performance_log = driver.get_log('performance') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\MP\Documents\MP_sandbox\WZPV4", line 52, in <module> save_page_html(driver, 'https://www.playscores.com/scanner-futebol-online/ao-vivo', 'rendered_page.html') selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: log type 'performance' not found (Session info: chrome=115.0.5790.102) Stacktrace: Backtrace: GetHandleVerifier [0x00007FF6DABA3E62+57250] (No symbol) [0x00007FF6DAB1BC02] (No symbol) [0x00007FF6DA9EE0BB] (No symbol) [0x00007FF6DAA5414C] (No symbol) [0x00007FF6DAA46770] (No symbol) [0x00007FF6DAA1CC71] (No symbol) [0x00007FF6DAA1DE54] GetHandleVerifier [0x00007FF6DAE54CF2+2879026] GetHandleVerifier [0x00007FF6DAEA6F30+3215472] GetHandleVerifier [0x00007FF6DAE9FD4F+3186319] GetHandleVerifier [0x00007FF6DAC35505+652869] (No symbol) [0x00007FF6DAB27518] (No symbol) [0x00007FF6DAB235F4] (No symbol) [0x00007FF6DAB236EC] (No symbol) [0x00007FF6DAB138E3] BaseThreadInitThunk [0x00007FFF7FAB7614+20] RtlUserThreadStart [0x00007FFF810826F1+33]