[Owasp-o2-platform] Problem with KeyPress, KeyDown or TypeText from o2 WatIn

daniel at brzozowski.biz daniel at brzozowski.biz
Mon Jun 6 05:25:09 EDT 2011


Hi all,
I'm playing with O2 "IE Automation" tool and I need to simulate keydown
event on a textbox (can't use TextField.value() function). Everytime I try
to call KeyDown, KeyPress or TypeText I get reflection exceptions.
Does anyone know any workaround to this problem? Like executing javascript
on WatiN_IE object?


Stack Trace from log viewer:
[09:49:12] ERROR:      InnerException:    at
mshtml.HTMLDocumentClass.IHTMLDocument2_get_parentWindow()
   at WatiN.Core.UtilityClass.FireEvent(DispHTMLBaseElement element,
String eventName, NameValueCollection eventObjectProperties)
   at WatiN.Core.UtilityClass.FireEvent(DispHTMLBaseElement element,
String eventName)
   at WatiN.Core.InternetExplorer.IEElement.FireEvent(String eventName,
NameValueCollection eventProperties)
   at WatiN.Core.Element.fireEvent(String eventName, Boolean
waitForComplete, NameValueCollection eventProperties)
   at WatiN.Core.Element.FireEvent(String eventName)
   at WatiN.Core.Element.Focus()
   at WatiN.Core.TextField.TypeAppendClearText(String value, Boolean
append, Boolean clear)
   at WatiN.Core.TextField.TypeText(String value)
   at DynamicType.dynamicMethod(Object returnData, Panel panel)  StackTrace:

   at mshtml.HTMLDocumentClass.IHTMLDocument2_get_parentWindow()
   at WatiN.Core.UtilityClass.FireEvent(DispHTMLBaseElement element,
String eventName, NameValueCollection eventObjectProperties)
   at WatiN.Core.UtilityClass.FireEvent(DispHTMLBaseElement element,
String eventName)
   at WatiN.Core.InternetExplorer.IEElement.FireEvent(String eventName,
NameValueCollection eventProperties)
   at WatiN.Core.Element.fireEvent(String eventName, Boolean
waitForComplete, NameValueCollection eventProperties)
   at WatiN.Core.Element.FireEvent(String eventName)
   at WatiN.Core.Element.Focus()
   at WatiN.Core.TextField.TypeAppendClearText(String value, Boolean
append, Boolean clear)
   at WatiN.Core.TextField.TypeText(String value)
   at DynamicType.dynamicMethod(Object returnData, Panel panel)


[09:49:12] ERROR:      InnerException: Specified cast is not valid.
Specified cast is not valid.
[09:49:12] ERROR: in reflection.invokeMethod_InstanceStaticPublicNonPublic
 StackTrace:

   at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[]
arguments, SignatureStruct& sig, MethodAttributes methodAttributes,
RuntimeTypeHandle typeOwner)
   at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[]
arguments, Signature sig, MethodAttributes methodAttributes,
RuntimeTypeHandle typeOwner)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture,
Boolean skipVisibilityChecks)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at O2.Kernel.InterfacesBaseImpl.KReflection.invoke(Object oLiveObject,
MethodInfo methodInfo, Object[] methodParameters)


[09:49:12] ERROR: in reflection.invokeMethod_InstanceStaticPublicNonPublic
Exception has been thrown by the target of an invocation.




More information about the Owasp-o2-platform mailing list