当前位置:编程学习 > C#/ASP.NET >>

如何模拟点击js生成的网页中的链接

有个网页是js生成的,查看源代码如下:
<script  type="text/JavaScript" charset="utf-8" src="../js/portlet.js" /></script>
<script type="text/javascript" src="../js/loginLog.js"></script>
<body style="margin:0px">
 
<table border="0" align="left">
   <tr align="center">
    <td align="center">
<table border="0" align="center" cellpadding="0" cellspacing="0">
   <tr>
     <td>
      <center>
       <table align="center">
 
    <tr>

       
        <td height="60">
<a href="#" onclick="javascript:window.open ('http://.......');addLog('...','..','...','...','..., ...., ...','..');return false;">
<img  src="/html/images/xtdd/nrgl.jpg" border="0"></a></td>
 
    

      </tr>
           
               </table>
               </center> 
              </table>
     </td>
   </tr>
   <tr align="left">
     <td align="left">       
 
  <table border="0" cellspacing="0" align="left">
     <tr>
  
    <td><img src="../images/xzz1.jpg" border="0" width="91" alt="第一页"/></td>
    
    <td><a href="javascript:void(0)"  onClick="javascript:window.open('newgxh.jsp?nodeId=ff8080813920414b01393428dd7c03b8',null,'height=700,width=600,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes')"><img src="../images/xz.jpg" width="38" height="17" border="0" alt="编辑个性化"/></a></td>
    
      <td ><img src="../images/xy1.jpg" width="91" border="0" alt="最后一页"></td>
    
    </tr>
   </table>
</td>
</tr>
</table>      
</body>
<script type="text/javascript"> 
<!--
</script>

像模拟点击里面的图标,不知道怎么捕捉到,用webbrowers捕获不到 --------------------编程问答-------------------- 模拟点击?表示你用什么程序写 在哪里写
我说个WinForm的写法吧
WinForm有个WebBrowser控件
你可以让他转向这个页面的url然后获取这个页面的html就是你发的这个
然后把这段html代码的head标签里注入一段javascript代码 例如function ClickTagA(){}
具体我就不写了 注入这个纯粹就是字符串拼接和裁剪
然后把这个注入后的html给webBrowser让他呈现
通过WebBrowser的调用JS的api调用你写的js
这个js是模拟点击的内个js
然后效果完成! --------------------编程问答-------------------- 我就是用的winform,本来想直接找到点击的链接,可是找不到,你说的有点明白,但是还不是太明白 --------------------编程问答-------------------- 楼主想的太复杂啦,,鼠标放上面就能看到地址啦 --------------------编程问答--------------------
引用 3 楼 t101lian 的回复:
楼主想的太复杂啦,,鼠标放上面就能看到地址啦

我吐血了 --------------------编程问答-------------------- MK...明早起来再研究。 --------------------编程问答-------------------- 楼主想的太复杂啦,,鼠标放上面就能看到地址啦 
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,