开发者

PopUp in MSHTML

开发者 https://www.devze.com 2023-03-24 15:10 出处:网络
I am working on a web automation application. Every thing is working fine. Now I have stuck into a pr开发者_如何学JAVAoblem.

I am working on a web automation application.

Every thing is working fine. Now I have stuck into a pr开发者_如何学JAVAoblem.

When user click over a link a new pop up is opened with input fields and button,

User fill fields and press button.

I want to automate this, but the problem is that when I click link and pop up is displayed no Document_Completed event is fired.

And so I am unable to parse this pop up html and automating it.

Any body has any helpful suggestion?


This is very tricky. I have been working on something similar myself. You first need to check if the dialog is Javascript or if it is a messagebox. With a javascript dialog you can try this: http://msdn.microsoft.com/en-us/magazine/gg309183.aspx. It can also work with a system dialog, but is not great for this, according to the author. If you can't make this work, you'll have to dig deep and try manipulating through Win32Api as far as I can tell.

System dialogs are not part of the DOM you would typically use for this type of automation. It has no ID and runs in a separate loop from the rest of the operating system (at a very low level, it is kept seperate from everything on purpose). For further understanding of dialogs and how they work in Windows check this out: http://www.winprog.org/tutorial/dialogs.html

I don't have a full solution to this, but I'm working on it.


One can get handle to popup by WindowFromPoint function. Then you may use IAccessible interface to acsess elements of popup. Something like this:

const uint OBJID_NATIVEOM = 0;
Guid  IID_IAcce = new Guid("{618736e0-3c3d-11cf-810c-00aa00389b71}");

IntPtr inpt = WindowFromPoint( p);

object ptr1 = null;
int l;

l = AccessibleObjectFromWindow(inpt, OBJID_NATIVEOM,    IID_IAcce.ToByteArray(), ref ptr1);
var acc = ptr1 as IAccessible;
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号