Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Submit 'username' and 'password' using the Document Object Model

Posted on 2007-11-25
5
Medium Priority
?
1,172 Views
Last Modified: 2013-11-19
Hi Experts,

I want to auto fill the username and password fields of a website login page using the document Object Model. The website main page contains one frame which contains the username and password fields. see attached code for iframe tag of the login frame and the login form code from the login frame. Thanks.
<iframe id="iframe" name="iframe" src="https://www.Domain.com?action=login_iframe"></iframe>
 
 
<form name="fmLogin" action="https://www.Domain.com" method="post">
    <input type="hidden" name="action" value="do_login" />
    <input id="username" name="Username" type="text" value="" />
    <input id="password" name="Password" type="password" value=""/>
    <a id="login" href="#" onclick="go_login();return false" title="Login">Login</a>
</form>

Open in new window

0
Comment
Question by:DColin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 

Author Comment

by:DColin
ID: 20345510
Sorry, I forgot to mention I am using the old axWebBrowser control not the newer WebBrowser control.
0
 
LVL 29

Expert Comment

by:QPR
ID: 20348730
why? if you plan to allow someone in with no credentials supplied then why use a username/password pair at all?
Just set a cookie with authenticated=true and have the login page check if authenticated=true?
If so then welcome else redirect.

I may understand better if you explained why you want to allow access to a password protected area without anyone having to specify a password.
axWebbrowser?
0
 

Author Comment

by:DColin
ID: 20349303
Hi QPR,

Sorry, I must have worded the question wrongly. Take a look at the following website

http://www.paddypower.com/bet

I want to login to this site. So I require the name and password fields filled and the login button clicked programmaticaly from my VB.Net application (probably) using the Document Object Model. Thanks.
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 20361443
Get the AutoIt! assembly. http://www.hiddensoft.com
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 2000 total points
ID: 20434374
Here is a VB.Net 2005 example of how to open up Google and then search for "Idle_Mind":
(not sure how to apply it to your page...I'm not good with web stuff!)
Public Class Form1
 
    ' Click on Project --> Add Reference --> COM Tab --> Select "Microsoft Internet Controls".
 
    Private loggedIn As Boolean = False
    Private WithEvents IE As SHDocVw.InternetExplorer
 
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If Not (IE Is Nothing) Then
            IE.Quit()
            IE = Nothing
        End If
 
        loggedIn = False
        IE = New SHDocVw.InternetExplorer
        IE.Visible = True
        IE.Navigate2("http://www.google.com")
    End Sub
 
    Private Sub IE_DocumentComplete(ByVal pDisp As Object, ByRef URL As Object) Handles IE.DocumentComplete
        If Not loggedIn Then
            loggedIn = True
            IE.Document.All.Item("q").Value = "Idle_Mind"
            IE.Document.All("btnG").Click()
        End If
    End Sub
 
    Private Sub IE_OnQuit() Handles IE.OnQuit
        IE = Nothing
    End Sub
 
End Class

Open in new window

0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question