Hello I am trying to automate my IE to log into a website but the problem is that the input elements do not have an HTML ID attribute! For example:
<input type="text" name="user" size="15" value="">
How do you program C# to insert text in this text box?
Thanks
Add the following attributes to your input tag: runat="server"
and id="someId"
<input id="user" type="text" size="15" runat="server">
Then server-side you do:
user.Text = "sample text";
Then you can do something like:
foreach (Control c in Page.Controls)
{
TextBox t = c as TextBox;
if (t != null)
{
t.Text = "sample text";
}
}
But I'm not sure it'll work without the runat="server"
attribute