C# WebBrowser按钮是否在没有图元ID的情况下单击?
我正在为一个论坛开发一个登录系统,并试图通过c#net表单使其正常工作。我需要在论坛上用webBrower控件编程单击登录按钮。到目前为止,我有这个C# WebBrowser按钮是否在没有图元ID的情况下单击?,c#,login,browser,system,C#,Login,Browser,System,我正在为一个论坛开发一个登录系统,并试图通过c#net表单使其正常工作。我需要在论坛上用webBrower控件编程单击登录按钮。到目前为止,我有这个 webPage page = new webPage(); page.URL = txtURL.Text; page.Load(); //Load the text from the specified URL WebBrowser browser = new WebBrowser(); browser.Document.GetElementB
webPage page = new webPage();
page.URL = txtURL.Text;
page.Load(); //Load the text from the specified URL
WebBrowser browser = new WebBrowser();
browser.Document.GetElementById("navbar_username").SetAttribute("value", textBox1.Text);
browser.Document.GetElementById("navbar_password").SetAttribute("value", textBox2.Text);
HtmlElement el = browser.Document.All["btnI"];
if (el != null)
{
el.InvokeMember("click");
}
else
{
MessageBox.Show("There is an issue with the program");
}
问题是,页面上的登录按钮没有ID或任何真实信息可以让我点击它。有人有什么建议吗?这是登录按钮的代码
<input type="image" src="images/loginbutton.png" class="loginbutton" tabindex="104" value="Log in" title="Enter your username and password in the boxes provided to login, or click the 'register' button to create a profile for yourself." accesskey="s">
在输入按钮上有一个
accesskey
属性,该属性在页面中是唯一的
循环浏览所有输入按钮,找到具有设置为s
的accesskey
属性的按钮。这将是您的提交按钮
使用jQuery,您可以使用以下命令来选择此元素:
$('input[accesskey="s"]')
输入按钮上有一个
accesskey
属性,该属性在页面中是唯一的
循环浏览所有输入按钮,找到具有设置为s
的accesskey
属性的按钮。这将是您的提交按钮
使用jQuery,您可以使用以下命令来选择此元素:
$('input[accesskey="s"]')
您可以使用
webBrowser1.Document.GetElementsByTagName(“输入”)
,这样您就可以在每个HTMLElement中循环并查找
元素。innerText==“登录”
,这样您就可以使用按钮……您可以使用
webBrowser1.Document.GetElementsByTagName(“输入”)
这样你就可以循环浏览每个HTMLElement并查找
元素。innerText==“登录”
这样你就可以点击按钮了……你能提交表单吗?那个页面上还有其他按钮吗?您能提交表单吗?那页上还有按钮吗