Handle flash button using WatiN
I am using WatiN for browser automation. Its cool. But today i ended up in a problem where i need to call the flash object (uploadify button) in my asp.net page.
This code seems working fine, but doesn't show any actions
开发者_高级运维 Element ele = window.Element(Find.ById("uploadifyUploader"));
ele.Click();
Is there a way to achive this in WatiN.?
I could be wrong, but I think that firing ele.Click()
results in clicking on <object/>
element, but not the button. The content of the <object/>
element is just an application. You have flash object there, but it could be, for example, Java applet.
Clicking on that button is similar to clicking button on different application - you have to automate Windows, not IE, so some kind of API calls will be needed, like FindWindowEx
or SendMessage
etc. I think that using WatiN.Core.Native.Windows
namespace could be a little bit helpful, but probably insufficient. You will have to use some extern methods from user32.dll
.
Instead of this, you could use some kind of library for Windows automation. I heard that AutoIt is good, but I didn't use it. For small tasks I prefer to deal with native calls.
Additionally, WinSpy++ is very helpful for finding windows properties.
精彩评论