How to upload a file with watir and IE?

前端 未结 5 1357
情歌与酒
情歌与酒 2020-12-18 01:07

I am writing a watir script to test an upload form.

But the script does not automatically choose the file that is to be uploaded from my harddrive.

Instead I

5条回答
  •  温柔的废话
    2020-12-18 01:44

    I had the same problem today (March1,2012) and landed here via Google.

    Thanks Željko for pointing me in the right direction, however the solution of changing the [POPUP_TITLES] didn't work. In fact, this array seems not to exist anymore in the current version of the gem (watir-2.0.4), or maybe I just misread.

    I solved the problem in watir-2.0.4/lib/watir/dialogs/file_field.rb: Here, the various window and button titles are defined as regular expressions. Change the regexps in the following methods

    • open_button()
    • cancel_button()
    • file_upload_window()

    to match your localized window names. After reloading the gem, it worked flawlessly.

提交回复
热议问题