不能使用HTMLElementCollection点击提交按钮

本文关键字:提交 按钮 HTMLElementCollection 不能 | 更新日期: 2023-09-27 18:10:32

<fieldset><b>&nbsp;</b><button id="submit" class="googleCheckPosButt" 
   onclick="docSubmit()">CHECK</button></fieldset>
</form>

这是一个网页的源代码,我试图将数据放入表单并提交,但我成功地将数据输入到网页的文本字段中,但我无法点击它

theElementCollection = 
            webBrowser1.Document.GetElementsByTagName("input");
foreach (HtmlElement curElement in theElementCollection)
{
        if (curElement.GetAttribute("id").Equals("submit"))
        {
           curElement.InvokeMember("click");                   
        }
}

请帮助! !

不能使用HTMLElementCollection点击提交按钮

我认为你的查询没有得到提交按钮。您需要将其更改为:

theElementCollection = 
            webBrowser1.Document.GetElementsByTagName("button");

对于您在评论中提到的问题,您可能应该使用web浏览器。