Home > OS >  How can I accept this cookies using selenium?
How can I accept this cookies using selenium?

Time:06-10

I'm trying to scrape this website https://www.parkers.co.uk but for some reason I cannot seem to get past the cookies pop up, I've tried with this code

cookies = driver.find_element_by_xpath('//*[@id="notice"]/div[5]/button[2]') cookies.click()

but it doesn't seem to be working, what can I do?

CodePudding user response:

Try this:

 iframe = driver.find_element_by_xpath("//iframe[@title='SP Consent Message']")
 driver.switch_to.frame(iframe)
 driver.find_element_by_xpath("//button[@title='Accept All']").click()
  • Related