Warning (from warnings module):
File "C:/Users/hp/AppData/Local/Programs/Python/Python310/sleeeepp.py", line 8
driver = webdriver.Chrome('C:\\path\\to\\chromedriver.exe')
DeprecationWarning: executable_path has been deprecated, please pass in a Service object
Traceback (most recent call last):
File "C:\Users\hp\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\common\service.py", line 74, in start
self.process = subprocess.Popen(cmd, env=self.env,
File "C:\Users\hp\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 966, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\hp\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1435, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/hp/AppData/Local/Programs/Python/Python310/sleeeepp.py", line 8, in <module>
driver = webdriver.Chrome('C:\\path\\to\\chromedriver.exe')
File "C:\Users\hp\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 69, in __init__
super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], "goog",
File "C:\Users\hp\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 90, in __init__
self.service.start()
File "C:\Users\hp\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\common\service.py", line 84, in start
raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH. Please see https://chromedriver.chromium.org/home
---------------------------THIS IS MY CODE--------------------------____
import time
from selenium import webdriver
video_link = 'https://www.youtube.com/watch?v=8R7TrzG4XsQ&t=20s'
views = 100
video_duration = 7 * 60
driver = webdriver.Chrome()
driver.get(video_link)
for i in range(views):
time.sleep(video_duration)
driver.refresh()