1

我对 Dragon Naturally 说话软件很陌生。我主要将它用于Web应用程序。我能够导航到所有按钮和其他元素,但不能导航到用于上传文件的“浏览”按钮。我尝试添加属性 alt、title 和 name,但 dragon 无法识别它。 <input type="file" title="Upload file" alt="Upload file" name="upload">

是否有特定命令可以单击上传按钮?或者我们应该创建自定义命令?

4

1 回答 1

1

如果您的浏览器是 Microsoft Internet Explorer,并且您知道“浏览”按钮的 ID,则此代码应为您单击它:

Sub Main 
   Dim wb As Object '  prepare a web browser object 
   Set wb = CreateObject("Shell.Application").Windows.Item(0) '  set the wb object to the active window, namely Item(0) 
   wb.Visible = True '  wb must be visible to the code for it to act 
   wb.Document.getElementByID("the_exact_ID_name_of_the_element").click() '  the element ID can also be passed in as a variable 
   Set wb = Nothing
End Sub

如果没有元素ID,可以按索引、类或控件类型等选择item。

于 2015-11-05T13:54:28.367 回答