I am trying to create a scraper, and for accessing the page I need to click on the Accept Cookies button. The HTML referring to the button is:
<div class="qc-cmp2-summary-buttons">
<button mode="secondary" size="large" class=" css-1hy2vtq">
<span>MORE OPTIONS</span>
</button><button mode="primary" size="large" class=" css-47sehv">
<span>AGREE</span></button></div>
The button I want to click is the second one, named "AGREE".
I tried:
driver.find_element(By.CLASS_NAME, " css-47sehv").click()
and I get error selenium.common.exceptions.InvalidSelectorException: Message: invalid selector: An invalid or illegal selector was specified
driver.switch_to.frame(frame), and then look for the button and click on it.