2.3selenium中下载文件

作者: 测试星云 | 来源:发表于2020-03-21 16:17 被阅读0次
    from selenium import webdriver
    from webdriver_manager.chrome import ChromeDriverManager
    
    options=webdriver.ChromeOptions()
    default_path ={"download.default_directory":"/Users/lindafang/PycharmProjects/selenium3forpython2020"}
    options.add_experimental_option("prefs",default_path)
    driver = webdriver.Chrome(ChromeDriverManager().install(),chrome_options=options)
    driver.get("https://github.com/lindafanglizhi/restAssuredTest")
    driver.find_element_by_css_selector("#js-repo-pjax-container > div.container-lg.clearfix.new-discussion-timeline.px-3 > div > div.file-navigation.in-mid-page.d-flex.flex-items-start > span > details > summary").click()
    driver.find_element_by_css_selector("#js-repo-pjax-container > div.container-lg.clearfix.new-discussion-timeline.px-3 > div > div.file-navigation.in-mid-page.d-flex.flex-items-start > span > details > div > div > div.get-repo-modal-options > div.mt-2.d-flex > a.flex-1.btn.btn-outline.get-repo-btn.js-anon-download-zip-link").click()
    driver.quit()
    
    

    相关文章

      网友评论

        本文标题:2.3selenium中下载文件

        本文链接:https://www.haomeiwen.com/subject/uxxuyhtx.html