Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#单击具有相同id的html按钮_C#_Html_Automation_Click_Send - Fatal编程技术网

C#单击具有相同id的html按钮

C#单击具有相同id的html按钮,c#,html,automation,click,send,C#,Html,Automation,Click,Send,谁能帮帮我吗。 我需要知道如何使用webbrowser自动生成表单,只需单击包含“报告”文本的按钮即可。 我不能用ID,因为他们都有“发送”ID this.form.target=''; this.form.action='/foglioorario.php'; 这个.form.submit();“>地拉那 阿尔法:% TMS: 暂停: 展示区: 我想我明白你的意思,如果这对你有效,请告诉我 IHTMLElementCollection buttonCol = doc.getElementsBy

谁能帮帮我吗。 我需要知道如何使用webbrowser自动生成表单,只需单击包含“报告”文本的按钮即可。 我不能用ID,因为他们都有“发送”ID

this.form.target='';
this.form.action='/foglioorario.php';
这个.form.submit();“>地拉那
阿尔法:%
TMS:
暂停:
展示区:

我想我明白你的意思,如果这对你有效,请告诉我

IHTMLElementCollection buttonCol = doc.getElementsByTagName("input");
foreach (IHTMLElement btn in buttonCol)
{
    if (btn.getAttribute("value") == "Report")
    {
        btn.click();
        break;
    }
}

你的回答救了我一命,我只是稍微修改了一下,没有使用mshtml。 这就是我使用它的方式:

        WebBrowser wb = webBrowser1;
        var doc = wb.Document;
        HtmlElementCollection el = doc.GetElementsByTagName("input");
        foreach (HtmlElement btn in el)
        {
            if (btn.GetAttribute("value") == "Report")
            {
                btn.InvokeMember("click");
                break;
            }
        }

很好,thnx

您的示例中混合了javascript和html,您能解释一下是什么吗?
        WebBrowser wb = webBrowser1;
        var doc = wb.Document;
        HtmlElementCollection el = doc.GetElementsByTagName("input");
        foreach (HtmlElement btn in el)
        {
            if (btn.GetAttribute("value") == "Report")
            {
                btn.InvokeMember("click");
                break;
            }
        }