Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Python selenium中下载MP3文件(弹出窗口)?_Python_Selenium_Audio - Fatal编程技术网

如何在Python selenium中下载MP3文件(弹出窗口)?

如何在Python selenium中下载MP3文件(弹出窗口)?,python,selenium,audio,Python,Selenium,Audio,我想下载一个MP3文件,当我点击ID“imgAudioCaptcha”声音按钮时。(python 2.7)-(我的firefox版本:43) 我想保存下载,但无法保存,如果不下载文件,程序将关闭 请帮帮我。非常感谢 注意:如果您有IDM(Internet下载管理器),您可以在单击声音按钮后看到弹出的文件 网站: 来源: from selenium import webdriver import selenium, time, os profile = webdriver.FirefoxProf

我想下载一个MP3文件,当我点击ID“imgAudioCaptcha”声音按钮时。(python 2.7)-(我的firefox版本:43)

我想保存下载,但无法保存,如果不下载文件,程序将关闭

请帮帮我。非常感谢

注意:如果您有IDM(Internet下载管理器),您可以在单击声音按钮后看到弹出的文件

网站:

来源:

from selenium import webdriver
import selenium, time, os

profile = webdriver.FirefoxProfile()
profile.set_preference('startup.homepage_welcome_url.additional', "http://it.kntu.ac.ir/Dorsapax/signin.aspx")
profile.set_preference('browser.download.hide_plugins_without_extensions', False)
profile.set_preference('extensions.mozilla_cc@internetdownloadmanager.com.install-event-fired', False)
profile.set_preference('browser.startup.page', "1")
profile.set_preference("browser.download.folderList", "2")
profile.set_preference("browser.download.dir", os.getcwd())
profile.set_preference("browser.helperApps.neverAsk.openFile", "audio/mpeg")
profile.set_preference("browser.helperApps.neverAsk.saveTsoDisk", "audio/mpeg")

driver = webdriver.Firefox(profile)
driver.implicitly_wait(30)
driver.set_window_size(850, 650)

cap_audio = driver.find_element_by_id("imgAudioCaptcha").click()

driver.close()

tnx可能重复;但是,我的问题与你的链接无关。单击音频验证码按钮后,我在下载MP3文件时遇到问题。