Webdriver: File Upload

后端 未结 7 1226
日久生厌
日久生厌 2020-11-27 18:16

Is there a way to interact with a File Upload box in webdriver? The form field where the path gets put in is read only so I can\'t write to that.

7条回答
  •  被撕碎了的回忆
    2020-11-27 18:53

    You can do this without injecting JavaScript. You just need to get hold of the form field and type into it. Something like (using the Ruby API):

    driver.find_element(:id, 'upload').send_keys('/foo/bar')
    

提交回复
热议问题