Answer the question
In order to leave comments, you need to log in
How to download media from Selenium in headless?
thumb = driver.find_elements(By.XPATH, '//*[@class="copyable-area"]//div[contains(@class, "video-thumb")]')
print('1')
try:
action = ActionChains(driver)
action.move_to_element(thumb[-1])
print('2')
action.perform()
time.sleep(0.2)
except Exception as e:
print(e)
try:
print('3')
thumb[-1].click()
except Exception as e:
print(e)
WebDriverWait(driver, 10).until(ec.presence_of_element_located((By.XPATH, '//*[@id="app"]/div/span[3]/div/div/div[2]/div[1]/div[2]/div')))
print('4')
time.sleep(0.2)
dwnld = driver.find_element(By.XPATH, '//*[@id="app"]/div/span[3]/div/div/div[2]/div[1]/div[2]/div/div[4]/div')
print('5')
try:
action = ActionChains(driver)
action.move_to_element(dwnld)
action.perform()
print('6')
time.sleep(0.2)
except Exception as e:
print(e)
try:
dwnld.click()
print('7')
except Exception as e:
print(e)
con_exit = driver.find_element(By.XPATH, '//*[@id="app"]/div/span[3]/div/div/div[2]/div[1]/div[2]/div/div[5]/div')
action = ActionChains(driver)
action.move_to_element(con_exit)
action.perform()
time.sleep(0.2)
con_exit.click()
Answer the question
In order to leave comments, you need to log in
I assumed that the headless driver does not know which folder to put your download in, and googled something like this https://stackoverflow.com/questions/45631715/downl...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question