VS 2010 [RESOLVED] Invoking webpage submit button-VBForums
Results 1 to 6 of 6

Thread: [RESOLVED] Invoking webpage submit button

  1. #1

    Thread Starter
    Hyperactive Member JXDOS's Avatar
    Join Date
    Aug 2006
    Location
    Mars...
    Posts
    423

    Resolved [RESOLVED] Invoking webpage submit button

    Hi all,

    I am having a bit of trouble invoking a button without any id or tag name from a webpage.

    Here is the html code.

    <div class="sbSubmit"><ul class="buttons floatRight" style='display:none;'><li class="btn" onclick="if ( validateSb() ) doLinkSubmit('../ha/default.aspx');return false;"/><div class="prettyBtn primaryBtn"> <span> Search </span></div>

    Any suggestions on how to invoke the clicking of this button?

    Thanks in advance.
    Last edited by JXDOS; Jul 6th, 2013 at 08:55 AM. Reason: Prefix
    If my post has been helpful, please rate it!

  2. #2
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,242

    Re: Invoking webpage submit button

    without any id or tag name
    No tag name? Of course it's got a tag name! It can't exist without one. I'd start with tag "li", attribute classname (= "btn"), (try both click and onclick as member). If that doesn't get you anywhere try tag "div", attribute classname (= "sbSubmit").
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    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

    Thread Starter
    Hyperactive Member JXDOS's Avatar
    Join Date
    Aug 2006
    Location
    Mars...
    Posts
    423

    Re: Invoking webpage submit button

    Thanks for the reply, so do you mean something like:

    Dim allelements As HtmlElementCollection = WebBrowser1.Document.All

    For Each webpageelement As HtmlElement In allelements
    If webpageelement.GetAttribute("classname") = "btn" Then
    webpageelement.InvokeMember("onclick")
    End If
    Next

    ??
    AttributeName: class, classname
    Names: sbSubmit, btn, div, ul???
    InvokeMember: click , onoclick

    I am a bit confused with the order of things :/
    If my post has been helpful, please rate it!

  4. #4
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,242

    Re: Invoking webpage submit button

    Something very like that. The attribute is always 'classname' (that's the HTML standard). Try click first, then onclick (the standard is click but I've found onclick to be sometimes effective when that won't work).
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    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!

  5. #5

    Thread Starter
    Hyperactive Member JXDOS's Avatar
    Join Date
    Aug 2006
    Location
    Mars...
    Posts
    423

    Re: Invoking webpage submit button

    Thanks for your help! I got it to work. Apparently the combo was btn and onclick.
    If my post has been helpful, please rate it!

  6. #6

    Thread Starter
    Hyperactive Member JXDOS's Avatar
    Join Date
    Aug 2006
    Location
    Mars...
    Posts
    423

    Re: [RESOLVED] Invoking webpage submit button

    One more quick question, after sending the submit button, I need to wait for the page to load before extracting some data. I have a wait_for_page_load function but it still seems to be performing the actions before its fully loaded. I tried the thread.sleep function, but it doesn't seem to be helping.
    If my post has been helpful, please rate it!

Tags for this Thread

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.