Intente varias soluciones que encontré acá pero ninguna me funciono sigo obteniendo este código de error :
raise exception_class(message, screen, stacktrace) selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element ... is not clickable at point (509, 20). Other element would receive the click:
def Carre():
url="https://www.carrefour.com.ar/informatica/impresoras-y-cartuchos.html"
chrome_path=r"C:\ProgramData\Anaconda3\Lib\site-packages\selenium\webdriver\chrome\chromedriver.exe"
driver=webdriver.Chrome(chrome_path)
driver.get(url)
lenOfPage= driver.execute_script("window.scrollTo(0, document.body.scrollHeight);var lenOfPage=document.body.scrollHeight;return lenOfPage;")
match=False
while(match==False):
lastcount=lenOfPage
time.sleep(2)
lenOfPage=driver.execute_script("window.scrollTo(0, document.body.scrollHeight);var lenOfPage=document.body.scrollHeight;return lenOfPage;")
if lastcount==lenOfPage:
match=True
wait = WebDriverWait(driver, 20)
element = wait.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="top"]/body/div[1]/div[1]/div[1]/div[7]/div/div/div[2]/a')))
Create = driver.find_element_by_xpath('//*[@id="top"]/body/div[1]/div[1]/div[1]/div[7]/div/div/div[2]/a')
Create.click()
agregue la linea para ejecutar el click con JS y ahora me cierra el navegador
def Carre():
url="https://www.carrefour.com.ar/informatica/impresoras-y-cartuchos.html"
chrome_path=r"C:\ProgramData\Anaconda3\Lib\site-packages\selenium\webdriver\chrome\chromedriver.exe"
driver=webdriver.Chrome(chrome_path)
driver.get(url)
lenOfPage= driver.execute_script("window.scrollTo(0, document.body.scrollHeight);var lenOfPage=document.body.scrollHeight;return lenOfPage;")
match=False
while(match==False):
lastcount=lenOfPage
time.sleep(2)
lenOfPage=driver.execute_script("window.scrollTo(0, document.body.scrollHeight);var lenOfPage=document.body.scrollHeight;return lenOfPage;")
if lastcount==lenOfPage:
match=True
wait = WebDriverWait(driver, 10)
element = wait.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="top"]/body/div[1]/div[1]/div[1]/div[7]/div/div/div[2]/a')))
Create = driver.find_element_by_xpath('//*[@id="top"]/body/div[1]/div[1]/div[1]/div[7]/div/div/div[2]/a')
#Create.click()
driver.execute_script("arguments[0].click();", Create)