2017-06-05 194 views
1

我需要使用UFT將excel下載並保存到特定的位置。如何使用UFT下載和保存excel文件?

步驟1:如下面所見

enter image description here

步驟2單擊超鏈接:保存下載的Excel,如下所示。 enter image description here

您可以請教如何使用uft自動化這種情況?

+0

你爲什麼要點擊它?爲什麼你不能右擊鏈接並使用另存目標? –

回答

0

據我所知,UFT的網絡支持不能處理這種情況。這可能是UFT的基於圖像的自動化(aka Insight)可以使用的情況。

如果UFT無法將其識別爲原生WinButton s,則可以使用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,而SaveDropdown對象附加到上月底的向下箭頭。我還必須使用.SetSelection.Type方法,而不是正常的.Set,因爲SaveAs對話框最終會將文件保存爲最初指定的文件而不是所需的路徑和文件名。

您可以忽略LOG_Write語句,因爲它們是我用來跟蹤腳本進度的自定義函數。