Selenium WebDriver: Upload multiple files

前端 未结 3 440
无人共我
无人共我 2020-12-05 11:52

My test need to upload test files in different browsers (I use WebDriver + Java). For a single file upload, everything works fine. I just send the

3条回答
  •  天涯浪人
    2020-12-05 12:29

    The solution for me (selenium in python) was to just repeat send_keys for each image path before uploading.

    Example for two files:

    driver.find_element_by_name("filename").send_keys(file_path_1)
    driver.find_element_by_name("filename").send_keys(file_path_2)
    driver.find_elements_by_xpath("//*[contains(text(), 'Upload')]")[0].send_keys(Keys.RETURN)
    

提交回复
热议问题