Hello, I Have Automatic Downloading Python Script:
Below is the CODE:
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
links = [
'https://www.youtube.com/watch?v=AqCXX1ZK9bo'
]
for link in links:
browser=webdriver.Chrome(r'C:\Users\\Downloads\chromedriver')
browser.get('https://www.onlinevideoconverter.com/pt/youtube-converter')
ak=browser.find_element_by_id('texturl')
ak.send_keys(link)
au = WebDriverWait(browser, 40).until(EC.element_to_be_clickable((By.XPATH, '//*[text() = "Começar"]')) )
au.click()
time.sleep(5)
af = WebDriverWait(browser, 90).until(
EC.presence_of_element_located((By.ID, 'downloadq'))
)
browser.execute_script('arguments[0].click();', af)
When and activating the
af = WebDriverWait(browser, 90).until(
EC.presence_of_element_located((By.ID, 'downloadq'))
)
browser.execute_script('arguments[0].click();', af)
And Generated a Download in the Chrome bar. And My Goal is that When the Download reaches 100% the Tab will automatically close with a browser.close
What is missing?