IE11帧通知栏保存按钮

IE11帧通知栏保存按钮

本文介绍了IE11帧通知栏保存按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用MS Excel 2010和IE11的64位系统上,我使用此代码从网站自动执行下载过程:

On a 64-bit system with MS Excel 2010 and IE11 I'm using this code to automate download process from a website:

hWnd = FindWindowEx(IE.hWnd, 0, "Frame Notification Bar", vbNullString)

If hWnd Then
    hWnd = FindWindowEx(hWnd, 0&, "Button", "Save")
End If

If hWnd Then
    SetForegroundWindow (hWnd)
    Sleep 600
    SendMessage hWnd, BM_CLICK, 0, 0
End If

在帧通知栏出现之前一切正常。我正在获取此窗口的HWND,但无法获得保存按钮的HWND,因此我可以发送单击它。

Everything goes OK until the Frame Notification Bar appears. I'm getting the HWND of this window, but can't get the HWND of the "Save" button, so that I can send click to it.

推荐答案

如果有人仍在尝试找到解决方案,那么IE11就在这里。

If somebody is still trying to find the solution, for IE11 it's here.

在,而不是框架通知栏得到的确切对话框的标题,可能是英文查看下载 - Internet Explorer。这允许你抓住正确的hWnd。

On the very first line of the code of Vahagn Sargsyan above, instead of "Frame Notification Bar" get the exact title of the dialog box, which might be in English "View Downloads - Internet Explorer". This allows you to grab the right hWnd.

因为在IE11中没有更多按钮加速器来保存文件,请按照发布的解决方案。 / a / 32152712/7991036>此处。

Because in IE11 there no more button accelerator to Save files, follow the solution posted here by pmr.

从pmr代码中,只需获取以下行:

From pmr code, just get the following lines:

Set e = o.ElementFromHandle(ByVal h)
Dim iCnd As IUIAutomationCondition
Set iCnd = o.CreatePropertyCondition(UIA_NamePropertyId, "Save")

Dim Button As IUIAutomationElement
Set Button = e.FindFirst(TreeScope_Subtree, iCnd)
Dim InvokePattern As IUIAutomationInvokePattern
Set InvokePattern = Button.GetCurrentPattern(UIA_InvokePatternId)
InvokePattern.Invoke

这应该可以解决您的问题。通过法语本地化,这为我解锁了这种情况。

This should solve your issue. This unlocked the situation for me with French localisation.

这篇关于IE11帧通知栏保存按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 14:08