Selenium file upload leaves file selector window open (OS/X and Python)

后端 未结 1 1844
别跟我提以往
别跟我提以往 2021-01-15 02:57

I\'m able to upload a file to a remote server using Selenium, but the file selector dialog sticks around even once the file is uploaded. The Selenium FAQ notes that, \"You c

相关标签:
1条回答
  • 2021-01-15 03:31

    Don't click upload button at all.

    Set the filename via send_keys() and click "Go" (tested and works for me):

    element = driver.find_element_by_id("sbi_file_upload")
    element.send_keys('/Path/to/file.jpeg')
    driver.find_element_by_css_selector('div#sbi_sb_ipt span[name=go]').click()
    
    0 讨论(0)
提交回复
热议问题