I have a problem to make the function continue without the error NoSuchElementException.In this case the function is Selenium and it clicks on one point on the page to select all the files and the other to download the files, however sometimes the search has no files to click or no items to download, and it gives an error of NoSuchElementException. How do I pass it and continue the function without stopping the function? However the function stop with the error: selenium.common.exceptions.NoSuchElementException
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
sleep(2)
select_all = driver.find_element(
By.XPATH, '//*[@id="ng-form:ng-detail-dataTable:ng-data-table:selectionMode"]/div/div[2]')
select_all.click()
sleep(5)
download_all = driver.find_element(
By.XPATH, '//*[@id="ng-form:ng-toolbar:dowloadXmlAction"]')
download_all.click()
sleep(2)