I am trying to accept cookies consent with Selenium Python. I tried to search with CSS selector and XPath but nothing works. This is the HTML:
<button class="sc-1epc5np-0 dnGUzk sc-f7uhhq-2 coEmEP button button--filled button__acceptAll" type="button"><span theme="[object Object]" class="sc-1vlt5h-0 sc-1epc5np-1 cMLEOX baseText">Accept Cookies</span></button>
<span theme="[object Object]" class="sc-1vlt5h-0 sc-1epc5np-1 cMLEOX baseText">Accept Cookies</span>
</button>
I tried the following code :
WebDriverWait(driver, 40).until(EC.presence_of_element_located((By.CSS_SELECTOR, '.sc-1vlt5h-0.sc-1epc5np-1.cMLEOX.baseText')))
I also tried:
driver.find_element_by_css_selector("cMLEOX").click()
driver.find_element_by_css_selector(".cMLEOX").click()
Nothing works. What is the solution?