Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

194
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda