【问题标题】:WatiN FileUpload press open Button to fastWatiN FileUpload 按打开按钮快速
【发布时间】:2011-02-21 12:04:42
【问题描述】:


我有文件上传窗口的问题。当我第一次使用它时,它工作得很好,但是当我调用相同的功能来打开和上传文件时,打开按钮(在“选择要上传的文件”对话框中)被按下以加快速度。所以测试无法写入文件的完整路径,所以我无法打开文件。
函数源码:

public void OpenFileDialogAndUploadCsvFileWithName(string fileName, IE editPage)
        {
           var fileUploadDialog = editPage.HtmlDialog(Find.ByTitle(PageTitle));
            fileUploadDialog.WaitForComplete();

            FileUpload fileUpload = fileUploadDialog.FileUpload(Find.ById(new Regex("_FileUpload")));
            fileUpload.Set(fileName);
            Image image = fileUploadDialog.Image(Find.BySrc(new Regex("/icons/upload.png")));
            Element parentElement = image.Parent;

            parentElement.FireEventNoWait("onmouseup");
            parentElement.FireEventNoWait("onmousedown");
        }  

上传文件对话框从 Internet Explorer 模式对话框窗口打开。

【问题讨论】:

    标签: asp.net internet-explorer-8 watin


    【解决方案1】:

    您可能会发现文件上传对话框处理程序在不同的线程上运行,这就是您没有机会输入文本的原因。

    如果不是这种情况,而且对话框处理程序确实有问题,那么我将获取 fileUploadDialog 处理程序的代码并创建我自己的自定义较慢版本。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-15
      • 2020-10-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多