鱼C论坛

 找回密码
 立即注册
查看: 1887|回复: 1

Python+selenium下载文件后关闭Firefox,为啥就会报错呢?

[复制链接]
发表于 2017-9-2 23:57:43 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
    profile = webdriver.FirefoxProfile()
    profile.set_preference('browser.download.dir', 'd:\\')
    profile.set_preference('browser.download.folderList', 2)
    profile.set_preference('browser.download.manager.showWhenStarting', False)
    profile.set_preference('browser.helperApps.neverAsk.saveToDisk', 'application/zip')

    driver = webdriver.Firefox(firefox_profile=profile)

    driver.get('http://sahitest.com/demo/saveAs.htm')
    driver.find_element_by_xpath('//a[text()="testsaveas.zip"]').click()
    sleep(3)

    driver.quit()

执行到最后一步,driver.quit(),就会报错:Firefox已停止运行,代码没有报错信息,就是浏览器老报错,这是为什么?
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2017-9-3 13:35:22 | 显示全部楼层
查看鼓掌详情
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-12-23 15:30

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表