How can I automate downloads using IDM?

Question:

I want to automate downloading using selenium python which in turn carries the link to IDM. However, the thing is I can’t get to download using IDM.

Asked By: 007 AZx

||

Answers:

Thisis not good practice in selenium automation

Whilst it is possible to start a download by clicking a link with a browser under Selenium’s control, the API does not expose download progress, making it less than ideal for testing downloaded files. This is because downloading files is not considered an important aspect of emulating user interaction with the web platform. Instead, find the link using Selenium (and any required cookies) and pass it to a HTTP request library like libcurl.

Please refer seleniumhq site

Answered By: Justin Lambert

This is the syntax to run IDM in Python. It will download to the default local path. Use an additional parameter ‘/p’ to change the local path if needed.

from subprocess import run

idm_path = "C:Program Files (x86)Internet Download Manageridman.exe"
url = "example url"
filename = "song.mp3"
run([idm_path, '/d', url, '/f', filename, '/n'])

source: Start IDM download from command line.

Answered By: firebfm
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.