Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

190
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda