我有一个小问题要检查提交按钮 [英] I have a little problem to check for submit buttons

查看:69
本文介绍了我有一个小问题要检查提交按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图单击网页/网站上的按钮.无论是提交按钮还是预览按钮,或者我同意按钮.我在这里面临的问题是我无法单击几个按钮,因为某些网站具有以下内容:

I am trying to click on a button on a webpage/website. Whether it is a submit button or preview button or i agree button. The problem i am facing here is that i cannot click on few buttons because some websites have something like this:

<输入类型=重置" value =我不同意"> < input type ="submit" value =我同意">
<input type="reset" value="I do not agree"> <input type="submit" value="I agree">



在某些网站上是这样的:

< button type ="submit" name ="preview"> Preview</button>

在第二个示例中,我能够像这样轻松地执行click事件:



and on some sites it is like this:

<button type="submit" name="preview">Preview</button>

In the 2nd example i am able to do the click event easily like this:

private void preview()
       {
           HtmlElement ele = webBrowserCtl.Document.GetElementById("preview");
           if (ele != null)
           {
               ele.InvokeMember("click");
           }
       }



因为在第二个示例中,我可以使用名称"并可以使用它.但是在第一个代码中,没有任何名称"或什至任何"id"可用于查找此特定按钮并对其进行叮当响,它仅具有值".你能告诉我在这种情况下该怎么做吗?如何单击此类按钮?
问候.



because in 2nd example i can use "name" and can go with it. But in the first code there is no "name" or even any "id" that i can use to find this specific button and clink on it than, it has just the "value". Can you kindly tell me how to do that in the cases like that? how to click on such buttons?
Regards.

推荐答案

问题是您需要知道按钮所在的表单.是您所需要的.可以肯定地说x通常为0.
The issue is you need to know which form the button is in. Apart from that document.forms[x].submit(); is what you need. It''s a fair guess that x is usually 0.


这篇关于我有一个小问题要检查提交按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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