Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

189
Views
C# Webbrowser fill in login page programmatically

I have a login form I wanna fill programmatically in C# I have a webbrowser and I did it this way, but it doesn't fill the form.

<div>
    <label class="control-label" for="Login">Login</label>
    <input class="input-sm form-control" data-val="true" data-val-required="The Login field is required." id="Login" name="Login" type="text" value="">
</div>
<div>
    <label class="control-label" for="Password">Password</label>
    <input class="input-sm form-control" data-val="true" data-val-required="The Password field is required." id="Password" name="Password" type="password" value="">
</div>
<div>
    <input type="submit" class="btn btn-default btn-sm" value="Valider" id="CmdValider">
    <input type="button" class="btn btn-default btn-sm" value="Quitter" onclick="javascript:window.close();">
</div>

How I tried to fill them

webBrowser1.Document.GetElementById("Login").SetAttribute("Login", "myLogin");
webBrowser1.Document.GetElementById("Password").SetAttribute("Password", "myPassword");

I'm only able to click on the login button, which works but is useless until I find how to fill the login and password

webBrowser1.Document.GetElementById("CmdValider").InvokeMember("click");

Thanks for your help

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

For both queries, you should be doing

webBrowser1.Document.GetElementById("elementid").SetAttribute("value", "something");

The only difference is that in SetAttribute I'm passing the first argument as "value" instead of something else.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!