I am aware there have been similar questions, however the answers to the others do not seem to fix my issue.
I am able to open youtube and dismiss the sign-in pop-up, however I cannot seem to agree to cookies for the google pop-up. The reason why I am posting a similar question is because the common "driver.implicitly_wait(10)" solution only seems to work on the sign-in pop-up.
This suggests for some reason the xpath for the button only works for the youtube pop-up, and not the google pop-up.
My code:
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver=webdriver.Chrome(executable_path="C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe")
driver.implicitly_wait(10)
driver.get("https://www.youtube.com/watch?v=nYh-n7EOtMA")
driver.find_element_by_xpath("//*[@id='dismiss-button']").click()
driver.implicitly_wait(10)
driver.find_element_by_xpath("//*[@id='introAgreeButton']").click()
I also believe that this is also the correct piece of code to copy the xpath of the button from.
I would be really grateful for any potential solutions, and I'm really sorry if this is too similar to previous questions, I'm just really stumped.