大家好:
    请教一下,webbrowser控件打开网页后,弹出的新页面,怎样可以操控到啊?在打开的页面A里,录入用户编号,点验证按钮,如果编码已经存在,会把用户的信息在新页B用列表显示,选择返回到原来的页面A。用webbrowser打开页A,是可以操控到,但弹出的页B,怎样操控啊?

解决方案 »

  1.   

    那样你需要findwindow找到那个窗口,然后枚举窗体内部组件,找到你想要操作的
      

  2.   

    你先给个让webbrowser弹出页的html文件,好让大伙帮你研究啊
      

  3.   

    已经用findwindow找到窗体句柄,但里面一个button的句柄不知道怎样去找,请大侠们提供一下方法或者思路
      

  4.   

    页面内容如下<html xmlns="http://www.w3.org/1999/xhtml"><head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"><link class="component" href="/a4j/s/3_3_3.Finalorg/richfaces/renderkit/html/css/basic_classes.xcss/DATB/eAE7ff3HutDlM6QBGgsE-A__.jsf" rel="stylesheet" type="text/css"><link class="component" href="/a4j/s/3_3_3.Finalorg/richfaces/renderkit/html/css/extended_classes.xcss/DATB/eAE7ff3HutDlM6QBGgsE-A__.jsf" rel="stylesheet" type="text/css"><link class="component" href="/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/css/msg.css.jsf" rel="stylesheet" type="text/css"><link class="component" href="/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/css/msgs.css.jsf" rel="stylesheet" type="text/css"><script src="/a4j/g/3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript.jsf" type="text/javascript"></script><script type="text/javascript">window.RICH_FACES_EXTENDED_SKINNING_ON=true;</script><script src="/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/skinning.js.jsf" type="text/javascript"></script><link href="/styles/styles.css" rel="stylesheet" type="text/css">
    <link href="/styles/style_component.css" rel="stylesheet" type="text/css">
    <link href="/styles/overlay.css" rel="stylesheet" type="text/css"><script src="/Js/jQuery/jquery-1.4.2.min.js"><!--//--></script>
    <script src="/Js/jQuery/jquery.pubsub.js"><!--//--></script>
    <script src="/Js/jQuery/core.js"><!--//--></script>
    <script src="/Js/jQuery/jq-overlay.js"><!--//--></script>
    <script src="/Js/jQuery/jquery.json-2.2.min.js"><!--//--></script>
    <script src="/Js/jQuery/jquery.timers-1.2.js"><!--//--></script>
    <script src="/Js/jQuery/jq-rcpt.js"><!--//--></script>
    <script src="/Js/jQuery/jquery.date.js"><!--//--></script>
    <script src="/Js/datepicker/WdatePicker.js"><!--//--></script><link href="http://esales.10010.com/Js/datepicker/skin/WdatePicker.css" rel="stylesheet" type="text/css">
    <script src="/Js/component/Validation.js"><!--//--></script>    <title>证件类型校验结果</title>
        <script type="text/javascript"><!--    window.onload = function() {
           jQuery('#div_customer_list')[0].innerHTML = window.dialogArguments.oldCustInfo;
        }
        var jIdVal = function(id,index){
            return jQuery('#' + id + index).text();
        }
        
        var selectCustomer = function(index) {
            window.returnValue = {
                custType : "1", //老客户
                custId : jIdVal('span_customerID_' , index),
                custName : jIdVal('span_customerName_' , index),
                contPhone : jIdVal('span_contPhoneNo_' , index),
                contAddr : jIdVal('span_contAddr_' , index),
                custAddr : jIdVal('span_custAddr_' , index),
                certAddr : jIdVal('span_certAddr_' , index),
                certExpireDate : jIdVal('span_certExpireDate_' , index),
                sex : jIdVal('span_customerSex_' , index),
                contactPerson :jIdVal('span_contactPerson_' , index),
                custStatus :jIdVal('span_custStatus_' , index),
                customerLoc :jIdVal('span_customerLoc_' , index),
                custZip :jIdVal('span_customerZip_' , index),
                custBirth :jIdVal('span_customerBirth_' , index),
                certType :jIdVal('span_certType_' , index),
                certNo :jIdVal('span_certNum_' , index),
                customerEmail : jIdVal('span_customerEmail_' , index),
                resultMsg : "老客户"
            }
            window.close();
        }
    // -->//--></script>
      <style type="text/css"></style></head>
      <body><script language="javascript" src="/Js/basic.js"><!--//--></script>
    <script language="javascript" src="/Js/prototype1.6.1.js"><!--//--></script>
    <script language="javascript" src="/Js/essutil.js"><!--//--></script><script><!--
    <!-- function hasErrMsg() {
        if (typeof(_onErrorCalled) == 'boolean' && _onErrorCalled ) {
            return true;
        }
        
        return  ($("hidMmaximumSeverity").value != '');
    }function submitOnComplete() {
        pop('loading','popbg','hide');
        if(hasErrMsg()) {
           setTimeout(showErrMsg, 100);
        }
    }var showErrMsgCb = null;function showErrMsg(cb) {
         pop('waring','popbg','show');
         showErrMsgCb = cb;
    }function onWarnClick() {
        pop('waring','popbg','hide');
        pop('loading','popbg','hide'); 
        if(document.getElementById('warningMessage').innerHTML.indexOf('系统超时') >= 0) {
            window.location='/';
        }
        else {
            var cb = showErrMsgCb;
            showErrMsgCb = null;
            cb && cb();
        }
    };function onWarnKeyDown() {
        if(event.keyCode==13 || event.keyCode==32){
            onWarnClick();
        }
    };var a4jCallTimes = 0;// -->
    //--></script><span id="opSeverity"><input type="hidden" id="hidMmaximumSeverity" name="hidMmaximumSeverity" value=""></span><span id="_viewRoot:status"><span id="_viewRoot:status.start" style="display: none"></span><script type="text/javascript"><!--window.document.getElementById('_viewRoot:status.start').onstart=function(){if (++a4jCallTimes == 1){pop('loading','popbg','show');};};//--></script><span id="_viewRoot:status.stop"></span><script type="text/javascript"><!--window.document.getElementById('_viewRoot:status.stop').onstop=function(){if (--a4jCallTimes == 0) {submitOnComplete();};};//--></script></span>
    <div class="loading" style="display:none;" id="loading"></div>
    <div class="waring" style="display:none;" id="waring">
    <div class="waringinfo" id="warningMessage"><dl id="j_id9" class="rich-messages" style="display: none; "><dt></dt></dl></div>
    <div class="waringbtn" onkeydown="onWarnKeyDown();" onclick="onWarnClick();">
    确定
    </div>
    </div>
    <div class="popbg" style="display:none;" id="popbg">
    <iframe style="position:absolute;left:0;top:0;width:100%;height:100%;z-index:1;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);" scrolling="no"></iframe></div><script id="j_id12" type="text/javascript"><!--
    //<![CDATA[
    emptyFunction=function(){A4J.AJAX.Submit(null,null,{'similarityGroupingId':'j_id12','parameters':{'j_id12':'j_id12'} ,'actionUrl':'/pages/g3bsp/tagpop/custinfo/G3OldCustShow.jsf'} )};
    //]]>
    //--></script><script><!--<!--
    var _callBackFunction;
    var _onErrorCalled = false;A4J.AJAX.onError = function(req,status,message) { 
         _onErrorCalled = true;
         showClientMsg("服务不可用:" + message,function(){
           window.location.reload();
         });
    };A4J.AJAX.onExpired = function(loc,expiredMsg){
         _onErrorCalled = true;
        if(window.confirm("会话超时 " + expiredMsg + " for a location: "+loc)){
            return loc;
        } else {
            return false;
        }
    };
    function showClientMsg(msg, callBack) {
        _callBackFunction = callBack;
        
        var clientMsgId = $('clientMsgId');
        clientMsgId.innerHTML = msg;
        pop('clientWaring','clientPopbg','show');
    };
    function showClientMsgWoBtn(msg) {
        var clientMsgIdBtn = $('clientMsgIdBtn');
        clientMsgIdBtn.innerHTML = msg;
        pop('clientWaringWoBtn','clientPopbg','show');
    };function msgClose(){
    pop('clientWaring','clientPopbg','hide');
        if(_callBackFunction){
            var cbFunc = _callBackFunction;
            _callBackFunction = null;
            
         cbFunc();
        } 
    };function showSmileMsg(msg, callBack) {
        var clientMsgId = $('smileMsgId');
        clientMsgId.innerHTML = msg;
        pop('clientSmile','clientPopbg','show');
        _callBackFunction = callBack;
    };function smileClose(){
        pop('clientSmile','clientPopbg','hide');
        if(_callBackFunction){
            var cbFunc = _callBackFunction;
            _callBackFunction = null;
            
            cbFunc();
        } 
    };function onMsgClick() {
        msgClose(); 
        if(document.getElementById('clientMsgId').innerHTML.indexOf('系统超时') >= 0) {
            window.location='/';
        }
    };function onMsgKeyDown() {
        if(event.keyCode==13 || event.keyCode==32){
            onMsgClick();
        }
    };function onSmileKeyDown() {
        if(event.keyCode==13 || event.keyCode==32){
            smileClose();
        }
    };
    //-->//--></script><div class="waring" style="display:none;" id="clientWaring">
    <div class="waringinfo" id="clientMsgId"></div>
    <div class="waringbtn" onkeydown="onMsgKeyDown();" onclick="onMsgClick();">
    确定
    </div>
    </div><div class="waring" style="display:none;" id="clientWaringWoBtn">
    <div class="waringinfo" id="clientMsgIdBtn"></div>
    </div><div class="ok" style="display:none;" id="clientSmile">
    <div style="margin-left:100px;font-size:12px;margin-top:30px;" id="smileMsgId"></div>
    <div style="height: 18px; margin-top:30px; width: 50px; float: center; margin-right: 110px; margin-left:110px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 2px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #B7B7B7; border-right-color: #B7B7B7; border-bottom-color: #B7B7B7; border-left-color: #B7B7B7; background-color: #E0E0E2; text-align:center;cursor: pointer;" onkeydown="onSmileKeyDown();" onclick="smileClose();">
    确定
    </div>
    </div><div class="popbg" style="display:none;" id="clientPopbg">
    <iframe style="position:absolute;left:0;top:0;width:100%;height:100%;z-index:1;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);" scrolling="no"></iframe>
    </div>  <script><!--<!--
    if (false) {
        showClientMsg('');
    }
    //-->//--></script><form id="frmMain" name="frmMain" method="post" action="/pages/g3bsp/tagpop/custinfo/G3OldCustShow.jsf" enctype="application/x-www-form-urlencoded"><input type="hidden" name="_authKey" value="46fBr4AthFNlJyzZvp8h2AK11mIfQ=">
          <div class="c_content">
            
      

  5.   

    给个简单的html,简化问题!ps:你提供的html文件打开有问题,乱码,按钮点后提示网页错误
      

  6.   

    再搞个隐藏的webbrowser打开B,打开B的时候注意要用到A输入的相关参数,然后操控。