2017-06-08 3 views
1

私はシルクテスト17.5を使用して、WebアプリケーションのChrome 51で.netスクリプトを記録しています。開いているダイアログボックスでファイルをアップロードする必要があります。 これを達成するための賭けの方法は何ですか?シルクテスト - Chromeで開いたダイアログを記録する

ありがとうございます。

答えて

2

残念ながら、ファイルのアップロードにアクションレコーディングを使用することはできませんが、スクリプトを使用してこれを達成する方法があります。

ファイルのアップロードは、このサンプル・ページ上の1のように見える場合:http://the-internet.herokuapp.com/uploadあなたがアップロードコントロールに直接アップロードするファイルの名前を入力することができ、次のいずれか

With _desktop.BrowserApplication() 
    With .BrowserWindow() 
    .DomTextField("//INPUT[@id='file-upload']").TypeKeys("c:\temp\test.txt") 
    .DomButton("//INPUT[@id='file-submit']").Click() 
    Workbench.Verify("test.txt", .DomElement("//DIV[@id='uploaded-files']").Text) 
    End With 
End With 

それとも、アップロードをクリックすることができます「ファイルを開く」ダイアログを開き、Win32 API経由で自動化するコントロール:

With _desktop.BrowserApplication() 
    With .BrowserWindow() 
    .DomTextField("//INPUT[@id='file-upload']").Click() 
    End With 
End With 

With _desktop.Dialog("@caption='Open'") 
    .TextField("@caption='File name:'").SetText("c:\temp\test.txt") 
    .PushButton("@caption='Open'").Select() 
End With 

With _desktop.BrowserApplication() 
    With .BrowserWindow() 
    .DomButton("//INPUT[@id='file-submit']").Click() 
    Workbench.Verify("test.txt", .DomElement("//DIV[@id='uploaded-files']").Text)    
    End With 
End With 
関連する問題