Results 1 to 4 of 4

Thread: Cannot InvokeMember on HTML Page

  1. #1
    New Member
    Join Date
    Mar 02
    Location
    NJ
    Posts
    4

    Cannot InvokeMember on HTML Page

    I have a VB Net application that I have been running for over a year to login to a specific website

    Heritage Coins & Currency

    The page I'm now unable to loging is --> https://coins.ha.com/c/login.zx

    I am setting the text boxes as follows:
    WB1.Document.All("emailAddress").SetAttribute("Value", "sge")
    WB1.Document.All("password").SetAttribute("Value", "7476")

    Even though these values do actually display on the screen when I do GetAttribute I see that I have set the values.
    ?WB1.Document.All("emailAddress").getAttribute("Value")
    "sge"
    ?WB1.Document.All("password").getAttribute("Value")
    "7476"

    When i do InvokeMember as follows NOTHING HAPPENS and I receive no msgs
    WB1.Document.GetElementById("loginButton").InvokeMember("click")

    The HTML code smippet is:
    <input id="loginButton" name="loginButton" value="Sign-In" type="submit" tabindex="3">&nbsp;&nbsp;
    <input name="source" type="hidden" value="" />
    <input name="forceLogin" type="hidden" value="" />

    <input name="loginAction" value="log-in" type="hidden">

    I am an inexperienced Net programmer and I do not have a clue how to resolve

    thanks
    sandy
    sandy

  2. #2
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 12
    Posts
    5,501

    Re: Cannot InvokeMember on HTML Page

    WB1.Document.GetElementById("loginButton").InvokeMember("click")
    Works perfectly for me. Are you sure that the page is fully loaded when you run the invoke?
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  3. #3
    New Member
    Join Date
    Mar 02
    Location
    NJ
    Posts
    4

    Re: Cannot InvokeMember on HTML Page

    Yes the page is fully loaded.

    Are you going to the next page where just below the picture at the top to the right of center

    it should say "Welcome Sandy (Sign-Out)" This is what I am expecting.

    I get Welcome xxxx (Sign-In) which indicates the Login did not work
    sandy

  4. #4
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 12
    Posts
    5,501

    Re: Cannot InvokeMember on HTML Page

    Seems like it takes a hammer to crack this nut. This is the only reliable method I could find ....

    vb.net Code:
    1. Private Sub Whatever()
    2.         'whatever you do to make sure the page is fully loaded
    3.         Go()
    4.         Timer1.Start() 'tick 2000 possibly adjustable
    5.     End Sub
    6.  
    7.     Private Sub Go()
    8.         SendKeys.Send("sge") ' seems brute force and ignorance is needed!
    9.         SendKeys.Send(Chr(9))
    10.         SendKeys.Send("7476")
    11.         SendKeys.Send(Chr(9))
    12.         WB1.Document.GetElementById("loginButton").InvokeMember("click") 'first time confirms
    13.     End Sub
    14.  
    15.     Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
    16.         Timer1.Stop()
    17.         Go() 'second time's the charm
    18.     End Sub
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •