Webdriver: File Upload

后端 未结 7 1229
日久生厌
日久生厌 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:46

    We can use following (ruby API)

    @driver.find_element(:xpath, "html/body/div[1]/div[2]/div[1]/form/div[4]/div[7]/table/tbody/tr[1]/td[2]/input").send_keys "C:\\Users\\Public\\Pictures\\Sample Pictures\\Chrysanthemum.jpg"
    

    This is helped me to upload image.

提交回复
热议问题