How to deal with file uploading in test automation using selenium or webdriver

前端 未结 6 1347
谎友^
谎友^ 2020-12-03 03:09

I think that everybody who uses Webdriver for test automation must be aware of its great advantages for web development.

But there is a huge issue if file uploading i

6条回答
  •  无人及你
    2020-12-03 03:43

    Webdriver can handle this quite easily in IE and Firefox. Its a simple case of finding the element and typing into it.

    driver = webdriver.Firefox()
    element = driver.find_element_by_id("fileUpload")
    element.send_keys("myfile.txt")
    

    The above example is in Python but you get the idea

提交回复
热议问题