#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2012
    Posts
    2
    Rep Power
    0

    Question How to get that button name?


    Okay guys,
    I've been making this program to log in to a web page, I have done so that it can write the inputed text in the username and password textboxes, using these comands:
    Code:
    Code:
    webpage.Document.GetElementById("name").SetAttribute("value", username.Text)
    webpage.Document.GetElementById("pass").SetAttribute("value", password.Text)
    ------------------------
    The button clicking comand shuld be this:
    Code:
    Code:
     webpage.Document.GetElementById("button-name").InvokeMember("click")
    ------------------------
    But I can't get the button ID the same way i got the textboxes' ID, here is a snippet of the page:
    The ID's of the textboxes are there (name="") but the button's ID isn't.
    HTML Code:
    Code:
    </div>
    <form action="/user/login"  accept-charset="UTF-8" method="post" id="user-login">
    <div><div class="content_frame" style="margin-right: 100px; margin-top: 15px;">
    
    	<div class="page_form_container">
    
        	<div class="form-item">
    
            	<label for="name" style="font-size: 16px; font-weight: bold;">Username:</label>
    
                <input type="text" name="name" id="name" value="" />
    
            </div>
    
            <div class="form-item">
    
                <label for="pass" style="font-size: 16px; font-weight: bold;">Password:</label>
    
                <input type="password" name="pass" id="pass" value="" />
    
            </div>
    
        	
    
            <input type="submit" value="Log In" style="margin-left: 150px; margin-right: 0px;" class="popup_button form-submit" />
    
            
    
    	    <div class="popup_button" style="float: right; margin-right: 10px;">
    
    	        <a href="http://signup.PAGE.com">Create Account</a>	    </div>
    
    	    
    
    		<div style="margin-bottom: 15px; margin-left: 150px; margin-top: 25px;">
    
            	<a href="/account/recovery/username">Forgot Username? | </a>
    
            	<a href="/account/recovery/password">Forgot Password?</a>
    
        	</div>
    
        <input type="hidden" name="form_id" value="user_login" />
    
    	</div>
    
    </div>
    </div></form>
    I need help fast,
    Thanks for your time,
    CrazyVB
  2. #2
  3. Type Cast Exception
    Devshed Supreme Being (6500+ posts)

    Join Date
    Apr 2004
    Location
    OAKLAND CA | Adam's Point (Fairyland)
    Posts
    14,954
    Rep Power
    8617
    There is no ID, there really is no button defined, it's a submit form action "submit"
    medialint.com

    “Today you are You, that is truer than true. There is no one alive who is Youer than You.” - Dr. Seuss
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2012
    Posts
    2
    Rep Power
    0

    Question


    Originally Posted by medialint
    There is no ID, there really is no button defined, it's a submit form action "submit"
    But how can I, after using this:
    Code:
    webpage.Document.GetElementById("name").SetAttribute("value", username.Text)
    webpage.Document.GetElementById("pass").SetAttribute("value", password.Text)
    Make the form/web page actualy login?
  6. #4
  7. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,431
    Rep Power
    4539
    Creating a web based login system takes some work. I recommend you start with finding and downloading some open-source applications that do login and take a look at the coding done by those developers to get some ideas.
    ======
    Doug G
    ======
    Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.
    --Alfred Bester

IMN logo majestic logo threadwatch logo seochat tools logo