

how do i press enter on a cr-button with selenium python
# import the webdriver
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
import time
import csv
from math import floor
PATH = r'C:\Users\jj\chromedriver.exe'
driver = webdriver.Chrome(PATH)
driver.maximize_window()
driver.get('chrome://settings/clearBrowserData')
at this point, i get a pop-up from google.
I've tried using a bunch of different variations:
1) driver.switch_to.alert.send_keys(Keys.ENTER)
2) driver.switch_to.active_element.send_keys(Keys.ENTER)
3) driver.switch_to.active_element.find_element(By.ID, "clearBrowsingDataConfirm").send_keys(Keys.ENTER)
4) driver.find_element(By.XPATH, '//button[normalize-space(text())="Clear data"]')
since the actual text has leading and trailing spaces.
5) driver.find_element(By.ID, "clearBrowsingDataConfirm").send_keys(Keys.ENTER)
6) driver.find_element(By.CSS_SELECTOR,"* /deep/ #clearBrowsingDataConfirm").click();
i've also tried ```pyautogui``` and using ```pyautogui.hotkey('enter')```
nothing is working. also, why do i need to find an element if it is a cr-button? why can't i just press enter somehow?
i keep getting:
selenium.common.exceptions.NoSuchElementException