2016-07-26 61 views
3

我使用AutoIt工具與硒。我正在做的是當我的應用程序中出現「另存爲」對話框時,我得到一些默認值,該文件存儲在我的系統中。我正在嘗試將其重命名爲'New',正如我在下面的代碼中所述。但是我得到的問題是,文件名在對話框中被成功更改爲'新',但是當我點擊'保存'時,它將被保存爲默認文件名。在保存爲對話框中使用硒自動重命名文件名

$windowHandle = WinGetHandle("Enter name of file to save to…") 
WinActivate($windowHandle) 
ControlSetText("Enter name of file to save to…", "", "Edit1", "New") 
ControlClick("Enter name of file to save to…", "", "Button1") 
+0

誰能幫助我解決這個問題,謝謝! – testing

+0

嘗試點擊ControlSetText後的Edit1。 – Milos

+0

@Milos,我嘗試了你的建議,它沒有奏效 – testing

回答

0

它曾與此:

$windowHandle = WinGetHandle("Enter name of file to save to…") 
WinActivate($windowHandle) 

ControlSetText("Enter name of file to save to…", "", "Edit1", "2131221") 
ControlClick("Enter name of file to save to…", "", "Edit1") 
ControlSetText("Enter name of file to save to…", "", "Edit1", "5666") 
ControlClick("Enter name of file to save to…", "", "Edit1") 
ControlSetText("Enter name of file to save to…", "", "Edit1", Send(" {BACKSPACE}")) 
ControlSetText("Enter name of file to save to…", "", "Edit1", "New") 
ControlClick("Enter name of file to save to…", "", "Button1") 
相關問題