EJECUTO ESTO para conectarme automáticamente en Linkedin, pero cuando se trata de la página número 5, me dijeron: selenium.common.exceptions.StaleElementReferenceException: Mensaje: referencia de elemento obsoleto: ¿el elemento no está adjunto al documento de la página?
def repeat(): all_buttons: list[WebElement] = driver.find_elements_by_tag_name("button") connect_buttons = [btn for btn in all_buttons if btn.text == "Connect"] for btn in connect_buttons: driver.execute_script("arguments[0].click();", btn) time.sleep(2) send = driver.find_element_by_xpath("//button[@aria-label='Send now']") driver.execute_script("arguments[0].click();", send) time.sleep(2) close = driver.find_element_by_xpath("//button[@aria-label='Dismiss']") driver.execute_script("arguments[0].click();", close) time.sleep(10) follow_buttons = [btn2 for btn2 in all_buttons if btn2.text == "Follow"] for btn2 in follow_buttons: driver.execute_script("arguments[0].click();", btn2) time.sleep(10) driver.execute_script("window.scrollTo(0, document.body.scrollHeight);") time.sleep(10) Next_button = driver.find_element_by_xpath("//button[@aria-label='Next']") driver.execute_script("arguments[0].click();", Next_button) time.sleep(5) while True : repeat()...