When the browser opens it immediately closes unless there is a time.sleep() after it and im getting this error when trying to click a button
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="button"]"}
Heres my code:
import dhooks
from selenium import webdriver
from selenium.webdriver.common.by import By
from dhooks import Webhook, Embed
import time
from selenium.webdriver.chrome.service import Service
s=Service('/Users/pax/Desktop/Benzinga/chrome driver/chromedriver')
driver = webdriver.Chrome(service=s)
driver.maximize_window()
driver.implicitly_wait(20)
url='https://www.youtube.com/'
driver.get(url)
driver.find_element_by_id("button").click()