Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6326923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:11:00+00:00 2026-05-24T17:11:00+00:00

I’m trying to login programatically to https://www.salesgenie.com/Account/LogOn using WebBrwoser control. The problem is when

  • 0

I’m trying to login programatically to https://www.salesgenie.com/Account/LogOn using WebBrwoser control.

The problem is when I click on “Log On”, the browser doesn’t navigate to the next page in the LogonCompleted event.

HtmlElement userName = wBrowser.Document.GetElementById("username");
userName.SetAttribute("value", SomeUserName);

HtmlElement password = wBrowser.Document.GetElementById("password");
password.SetAttribute("value", SomePassword);

wBrowser.DocumentCompleted -= new WebBrowserDocumentCompletedEventHandler(LogonPageLoaded);
wBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(LogonCompleted);

HtmlElement logonForm = wBrowser.Document.GetElementById("logon-submit");
logonForm.InvokeMember("click");

I think this is because the element “logon-submit” calls a JavaScript function or so.

Please, any help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T17:11:01+00:00Added an answer on May 24, 2026 at 5:11 pm

    Check out your 4th line, you’re setting userName again when you should be setting password

    EDIT

    Besides the problem above I’m guessing that you’re trying to invoke the click too soon. The button is created using JavaScript so you have to wait a bit before clicking it. Unfortunately there’s no event that you can listen for to determine when the JavaScript is done although you could test various properties probably. The safest thing is to probably just wait a couple seconds after load before invoking click.

    The code below works for me (although I don’t have a valid username and password). I’ve got one button called button1 and one webbrowser called webBrowser1. Once the page is visually loaded in the browser clicking the button on the form correctly invokes the click event in the browser.

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    
    namespace WindowsFormsApplication1
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
    
            private void Form1_Load(object sender, EventArgs e)
            {
                this.webBrowser1.Navigate("https://www.salesgenie.com/Account/LogOn");
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                string SomeUserName = "Test";
                string SomePassword = "Test";
    
                HtmlElement userName = webBrowser1.Document.GetElementById("username");
                Console.WriteLine(userName.GetAttribute("value"));
                userName.SetAttribute("value", SomeUserName);
                userName.RemoveFocus();
    
                HtmlElement password = webBrowser1.Document.GetElementById("password");
                Console.WriteLine(userName.GetAttribute("value"));
                password.SetAttribute("value", SomePassword);
    
                HtmlElement logonForm = webBrowser1.Document.GetElementById("logon-submit");
                logonForm.InvokeMember("click");
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I am currently running into a problem where an element is coming back from
I am trying to loop through a bunch of documents I have to put
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.