首页 文章

如何使用UFT下载和保存Excel文件?

提问于
浏览
1

我需要使用UFT下载excel并将其保存到特定位置 .

第1步:单击超链接,如下所示

enter image description here

第2步:保存下载的excel,如下所示 .
enter image description here

你能否就如何使用uft自动化这种情况提出建议?

2 回答

  • 0

    据我所知,UFT 's web support can' t处理此类案件 . 这可能是UFT基于图像的自动化(aka Insight)可以使用的情况 .

    如果UFT无法将它们识别为本机 WinButton ,则可以使用Insight识别所需的按钮 .

  • 0

    我不得不应用自己的解决方法来管理从此设置中保存文件 . 这是我使用的代码:

    If Browser("AFBHome").WinObject("Notification").Exist(6) Then
        LOG_Write "Notification received - click Save dropdown to get file."
        Browser("AFBHome").WinObject("Notification").WinButton("SaveDropdown").Click micNoCoordinate,micNoCoordinate,micRightBtn
        Browser("AFBHome").WinObject("Notification").WinButton("SaveDropdown").Click
        Wait 0,500 ' Allow the dropdown to render
        Browser("AFBHome").WinObject("Notification").WinButton("SaveDropdown").Type "a"
        Dialog("Save As").Activate
        Wait 0,500
        LOG_Write "Getting file from AFB: " & Dialog("Save As").WinEdit("FileName").GetROProperty("text")
        Dialog("Save As").WinEdit("FileName").SetSelection 0,Len(Dialog("Save As").WinEdit("FileName").GetROProperty("text"))
        Dialog("Save As").WinEdit("FileName").Type sSaveLocation & sFilename
        LOG_Write "Attempting to save export file as " & sSaveLocation & sFilename 
        Dialog("Save As").WinButton("Save").Click
    End If
    

    我必须将通知栏作为WinObject学习到OR,并且SaveDropdown对象附加到末尾的向下箭头 . 我还必须使用 .SetSelection.Type 方法而不是普通的 .Set ,因为 SaveAs 对话框最终会将文件保存到最初指定的内容而不是所需的路径和文件名 .

    您可以忽略 LOG_Write 语句,因为它们是我用来跟踪脚本进度的自定义函数 .

相关问题