How can i upload files on dropzone.js with style=“display: none;” using Selenium?

前端 未结 1 1024
傲寒
傲寒 2021-01-25 21:11

I\'m trying to upload files on a website which using dropzone.js for file uploads. I\'ve found the file upload field in form, but the script stops without throwing any error. I\

相关标签:
1条回答
  • 2021-01-25 21:52

    As per the HTML you have shared the <input> tag is having style set to display: none;. You can use the following code block to upload the file :

    element = driver.find_element_by_xpath("//div[@id='fallback']")
    driver.execute_script("arguments[0].removeAttribute('style')", element)
    driver.find_element_by_xpath("//input[@id='upload-input']").send_keys("C:\\KVR.pdf")
    
    0 讨论(0)
提交回复
热议问题