1+ import json
2+ from selenium import webdriver
3+ from selenium .webdriver .support .ui import WebDriverWait
4+ from chromedriver_py import binary_path
5+ # Initialize Chrome WebDriver with performance logging enabled
6+ svc = webdriver .ChromeService (executable_path = binary_path )
7+ chrome_options = webdriver .ChromeOptions ()
8+ chrome_options .add_argument ('--remote-debugging-port=9222' ) # Enable DevTools Protocol
9+ chrome_options .add_argument ("--incognito" )
10+ chrome_options .add_argument ('--enable-logging' )
11+ chrome_options .add_argument ("--ignore-certificate-errors" )
12+ chrome_options .add_argument ("--disable-web-security" )
13+ chrome_options .add_argument ("--allow-running-insecure-content" )
14+ driver = webdriver .Chrome (service = svc , options = chrome_options )
15+
16+
17+ # Navigate to the target website
18+ driver .get ("https://www.linkvideo.download/" )
19+ WebDriverWait (driver , 30 ).until (
20+ lambda d : d .execute_script ('return document.readyState' ) == 'complete'
21+ )
22+ test = driver .execute_async_script (
23+ """
24+ var performance = window.performance || window.mozPerformance || window.msPerformance || window.webkitPerformance || { };
25+ var callback = arguments[arguments.length - 1];
26+ if (performance) {
27+ if (typeof(performance.getEntries)==='function'){
28+ performance = performance.getEntriesByType('resource').map(entry => entry.name);
29+ };
30+ callback(performance);
31+ } else { callback(null);}"""
32+ )
33+ #response = driver.execute_async_script("""var performance = window.performance || window.mozPerformance || window.msPerformance || window.webkitPerformance || { }; return performance;""")
34+ print (test )
35+ # Close the WebDriver
36+ driver .quit ()
0 commit comments