How do I use the FileUploadDialogHandler in watin to access the file upload dialog

丶灬走出姿态 提交于 2019-12-05 13:57:20

Your code looks OK. You don't have to use FileUploadDialogHandler. It is used internally when you call Set method.

Try this code

FileUploadDialogHandler fileupload = new FileUploadDialogHandler("filename.xls");
using (new UseDialogOnce(ie.DialogWatcher, fileupload ))
{
   //code to intiate the file upload, like button.Click()
}

I had the same issue. The dialog box was opening, but the filepath was not written. Dialog box was remained opened. I found a by pass. Before using .Set function use the .Click function.

Something like that :

ie.FileUpload(Find.ById("someId")).Click(); ie.FileUpload(Find.ById("someId")).Set("C:/Desktop/image.jpg");

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!