Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
this is html code
input class="textInput" name="prijava[password]" placeholder="lozinka" maxlength="100" size="100" type="password" data-reactid=".2.1.0.1.1.0.1">

What I have tried:

private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
foreach (HtmlElement he in webBrowser1.Document.All.GetElementsByName("prijava[password]"))
{

he.SetAttribute("value", "text");

}
}
but nothing happened
Posted
Updated 19-May-16 8:44am
Comments
ZurdoDev 19-May-16 7:59am    
Just add runat="server" and put an id on it and then you can reference it directly in c#.
Karthik_Mahalingam 19-May-16 8:23am    
i have tested, its working.
Sujith Karivelil 19-May-16 14:41pm    
I think the control is inside the web-page that is loaded into the web-browser control

1 solution

I Prefer you to use
C#
he.InnerText="samplePassword";
instead for
he.SetAttribute("value", "text");
; SO the Event should be like the following:

C#
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
   foreach (HtmlElement he in webBrowser1.Document.All.GetElementsByName("prijava[password]"))
   {
     he.InnerText="samplePassword"
   }
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900