0

The function opens the site and clicks on the download exe file button. But I get a window with the Keep and Discard buttons. How can I process them?

def buttonTSDownload(self):
        browser = webdriver.Chrome()
        browser.get('https://www.teamspeak.com/en/downloads/')
        xpath = '/html/body/div[1]/div/div/div/div/div/div[1]/div/div[1]/div[1]/div[2]/div[2]/div/a'
        browser.find_element(By.XPATH, xpath).click()

        file_path = f"C:/Users/{self.nameUsers}/Downloads/TeamSpeak3-Client-win64-3.5.6.exe"
        while not os.path.isfile(file_path):
            time.sleep(1)
        browser.quit()

enter image description here

zoomkaXXX
  • 5
  • 2
  • 1
    I can't add my answer since it reaches the allowed limit, I'm trying to manipulate the profile to avoid the download dialog, I leave the link check the answer marked with a green tick. https://stackoverflow.com/questions/18439851/how-can-i-download-a-file-on-a-click-event-using-selenium – Jahir Unzueta Apr 05 '23 at 08:57

1 Answers1

0

If someone has the same problem, then the solution is

prefs = {'safebrowsing.enabled': 'false'}
options.add_experimental_option("prefs", prefs)
zoomkaXXX
  • 5
  • 2