通过C#模拟html中的点击图片 [英] simulate click image in html through c#

查看:73
本文介绍了通过C#模拟html中的点击图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好
我正在编写某个网站的剪贴程序,用户必须输入搜索条件,然后单击gif图片...
在页面的html代码中,该图像仅具有以下属性:

Hello
i''m writing a scrapping program of some site ,and there user has to enter search criteria and then click on an gif image...
in the html code of the page , that image has this properties only:

<input type="image" src="/esignalprod/images/go.gif" border="0"/>



如您所见...没有id,没有名称...
如何找到该特定图像,当找到该图像时,如何模拟单击它?

谢谢你



as you can see... there is no id , no name ...
how can i find this specific image and when i find it , how can i simulate clicking on it?

thank you

推荐答案


试试这个
Hi ,
Try this
protected void Page_Load(object sender, EventArgs e)
  {
      img1.ServerClick += new ImageClickEventHandler(img1_ServerClick);
  }

  void img1_ServerClick(object sender, ImageClickEventArgs e)
  {
      Response.Write("<script>alert('test')</script>");
  }


<input type="image" src="/esignalprod/images/go.gif" border="0" id="img1" runat="server"/>


最好的问候
米特瓦里(M.Mitwalli)


Best Regards
M.Mitwalli


这篇关于通过C#模拟html中的点击图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆