找不到会员。 (来自HRESULT的异常:0x80020003(DISP_E_MEMBERNOTFOUND))

时间:2015-06-30 09:57:44

标签: javascript watin comexception

我正在使用WatiN进行IE自动化。我想自动化雅虎搜索(仅用于测试)。当我在启动IE后立即运行WatiN.Core.Document.Eval("js code")时,它可以工作,我可以在页面上运行我的javascript。但是当我在Yahoo中进行一些搜索然后调用WatiN.Core.Document.Eval("js code")时,它会抛出COMException DISP_E_MEMBERNOTFOUND。这是发生异常的方法(WatiN.Core.Native.InternetExplorer.Expando.cs)

public object GetValue(string propertyName)
        {
            var property = AsExpando.GetProperty(propertyName, BindingFlags.Default);
            if (property != null)
            {
                try
                {
                    return property.GetValue(Object, null);
                }
                catch (COMException)
                {
                    return null;
                }
            }

            return null;
        }

异常详情:

Member not found. (Exception from HRESULT: 0x80020003 (DISP_E_MEMBERNOTFOUND))

堆栈追踪:

at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
   at System.Runtime.InteropServices.CustomMarshalers.ExpandoViewOfDispatchEx.DispExInvoke(String pstrMemberName, Int32 MemberDispID, Int32 Flags, Binder pBinder, Object[] aArgs, ParameterModifier[] aModifiers, CultureInfo pCultureInfo, String[] astrNamedParameters)
   at System.Runtime.InteropServices.CustomMarshalers.DispatchExMethodInfo.Invoke(Object pObj, BindingFlags invokeAttr, Binder pBinder, Object[] aParameters, CultureInfo pCulture)
   at System.Runtime.InteropServices.CustomMarshalers.DispatchExPropertyInfo.GetValue(Object pObj, BindingFlags invokeAttr, Binder binder, Object[] aIndex, CultureInfo culture)
   at System.Reflection.PropertyInfo.GetValue(Object obj, Object[] index)
   at WatiN.Core.Native.InternetExplorer.Expando.GetValue(String propertyName) in d:\AdvancedSE\Releases\SE-Dev Rel 8.3.0.0\Source\CommonPlugins\Source\CommonPlugins\SE.Core.IEAutomation\WatiN\Core\Native\InternetExplorer\Expando.cs:line 48

请帮忙。

0 个答案:

没有答案
相关问题