Results 1 to 7 of 7

Thread: Can't click the button, web.

  1. #1
    New Member
    Join Date
    Aug 12
    Posts
    4

    Can't click the button, web.

    Hi, i can't find the way to click this button im the webpage.
    any ideas?

    HTML Code:
    <td class="dark" onclick="document.getElementById('ga_id').value = '3'; document.getElementById('gaform').submit()">ga videre</td>
    I have tried this code, and some other.

    Code:
    Dim allelements As HtmlElementCollection = WebBrowser1.Document.All
    'value = "3"
    
            For Each webpageelement As HtmlElement In allelements
    
                If webpageelement.GetAttribute("value") = "3" Then
    
                    webpageelement.InvokeMember("click")
    
                End If
    Next

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

    Re: Can't click the button, web.

    Try ...

    webpageelement.InvokeMember("onclick")

    It's not guranteed but it works occasionally.

  3. #3
    New Member
    Join Date
    Aug 12
    Posts
    4

    Re: Can't click the button, web.

    It doesnt work:/

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

    Re: Can't click the button, web.

    What's the website?

  5. #5
    New Member
    Join Date
    Aug 12
    Posts
    4

    Re: Can't click the button, web.

    Is it some codes that i can find the button with the id and use the value to press the right button?
    it is 4 values, 0, 1, 2, 3 in the html.
    Last edited by kimsen; Aug 21st, 2012 at 03:42 PM.

  6. #6
    New Member
    Join Date
    Aug 12
    Posts
    4

    Re: Can't click the button, web.

    No ideas?

  7. #7
    PowerPoster techgnome's Avatar
    Join Date
    May 02
    Posts
    21,786

    Re: Can't click the button, web.

    this isn't the right comparison...
    If webpageelement.GetAttribute("value") = "3" Then


    That element doesn't have a value attribute set to 3... in fact it doesn't have a value attribute at all. the only thing that identifies it is the class attribute... but then any element could have that same class as well, so that's not a good marker.

    In fact, there is nothing on that element that makes it uniquely identifiable... at all.

    Also, it's not a button. It's a table cell.

    What you might be able to do is mimic what the javascript code does in the onClick...
    YOU find the element (using the getElementByID) ... setting it's value... THEN clicking it...

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.-I also subscribe to all threads I participate, so there's no need to pm when there's an update.*
    *Proof positive that searching the forums does work: View Thread *
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *
    * Use Offensive Programming, not Defensive Programming. * On Error Resume Next is error ignoring, not error handling(tm).
    "There is a major problem with your code, and VB wants to tell you what it is.. but you have decided to put your fingers in your ears and shout 'I'm not listening!'" - si_the_geek on using OERN

Posting Permissions

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