关于webbrowser中点击按钮提交表单有关问题,非submit!死人
关于webbrowser中点击按钮提交表单问题,非submit!急死人啊
以163邮箱注册页面为例:http://reg.email.163.com/mailregAll/reg0.jsp?from=163mail
我填写好表单后,他的提交按钮我怎么都不能激活,提交不成功,请大家帮帮忙,弄了很长时间了,试了各种方法都不行~~~
下面的这种为什么不行呢???
------解决方案--------------------
办法很简单,你自己写一个submit类型的button,插入到网页中,然后点这个button就可以了.
------解决方案--------------------
为什么不行,我都是这么做的啊
------解决方案--------------------
干吗要模拟点击?
既然你已经在WB中加载了网页,填写好表单后直接调用doRegFormSubmit()那个脚本函数不就得了。
写了那么多代码就为了获得一个button,晕~
------解决方案--------------------
不能激活是个什么意思
------解决方案--------------------
直接调用Submit 因为你点击button他也是触发的这个事件
------解决方案--------------------
------解决方案--------------------
有时候,我也遇到这样的问题,就是调用:form.submit();所有的验证都通过,却并不能正常提交,不知道是为什么
以163邮箱注册页面为例:http://reg.email.163.com/mailregAll/reg0.jsp?from=163mail
我填写好表单后,他的提交按钮我怎么都不能激活,提交不成功,请大家帮帮忙,弄了很长时间了,试了各种方法都不行~~~
下面的这种为什么不行呢???
- C/C++ code
void SubmitForm( IHTMLDocument2 * pIHTMLDocument2 ) { if( !pIHTMLDocument2 ) return; EnumFrame( pIHTMLDocument2 ); //递归枚举当前 IHTMLDocument2 上的子框架fram HRESULT hr; CComBSTR bstrTitle; //pIHTMLDocument2->get_title( &bstrTitle ); //取得文档标题 USES_CONVERSION; CComQIPtr< IHTMLElementCollection > spElementCollection; CComQIPtr< IHTMLElementCollection > spElementCol; hr = pIHTMLDocument2->get_forms( &spElementCol ); //取得表单集合 if ( FAILED( hr ) ) { return; } long nFormCount1=0; //取得表单数目 hr = spElementCol->get_length( &nFormCount1 ); if ( FAILED( hr ) ) { return; } CComVariant ttype; for(long k=0; k<nFormCount1; k++) { //spElementCol->QueryInterface(IID_IHTMLElement,(void **)&pEle); IDispatch *pDisp1 = NULL; //取得第 k 项表单 hr = spElementCol->item( CComVariant( k ), CComVariant(), &pDisp1 ); CComQIPtr< IHTMLFormElement > spFormElement1 = pDisp1; pDisp1->Release(); long nElemCount1=0; //取得表单中 域 的数目 hr = spFormElement1->get_length( &nElemCount1 ); //操作是否成功 if ( FAILED( hr ) ){ continue; } //IHTMLInputTextElement* pInput; CComVariant type1; CString temp; CString temp2; for(long c=0; c<nElemCount1; c++) { CComDispatchDriver spInputElement1; IHTMLElement* pHElement; //取得第 c 项表单域 hr = spFormElement1->item( CComVariant( c ), CComVariant(), &spInputElement1 ); if ( FAILED( hr ) ){ continue; } spInputElement1->QueryInterface(IID_IHTMLElement,(void **)&pHElement); LPCTSTR lpType = NULL; CComVariant vType; BSTR bDisplay; CString csDisplay; IHTMLStyle *pStyle; if (pHElement != NULL) { //取得表单域的类型 hr = pHElement->getAttribute(_bstr_t("type"), 0, &vType); if( FAILED( hr ) ){ continue; } lpType = vType.bstrVal ? OLE2CT( vType.bstrVal ) : _T("NULL"); //未知类型 // if (strcmp(lpType, "button") == 0) { //点击按钮,不管用,请高手明示 pHElement->click(); break; } } } } }
------解决方案--------------------
办法很简单,你自己写一个submit类型的button,插入到网页中,然后点这个button就可以了.
------解决方案--------------------
为什么不行,我都是这么做的啊
------解决方案--------------------
干吗要模拟点击?
既然你已经在WB中加载了网页,填写好表单后直接调用doRegFormSubmit()那个脚本函数不就得了。
写了那么多代码就为了获得一个button,晕~
------解决方案--------------------
不能激活是个什么意思
------解决方案--------------------
直接调用Submit 因为你点击button他也是触发的这个事件
------解决方案--------------------
------解决方案--------------------
有时候,我也遇到这样的问题,就是调用:form.submit();所有的验证都通过,却并不能正常提交,不知道是为什么