Results 1 to 7 of 7

Thread: [RESOLVED] Isit possible to click just text in webbrowser?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2008
    Posts
    177

    Resolved [RESOLVED] Isit possible to click just text in webbrowser?

    Ill try explain.

    Say i have webbrowser 1 and there is some text on a page that is displayed that says something like "Iamsomerandomtext" and its the only text on the page that says that. It has no name or id's or tags or anything.

    Would it be possible for me to click it for example :

    vb Code:
    1. webbrowser1.document.all("Iamsomerandomtext").click

    Sorry if this is just impossible

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Isit possible to click just text in webbrowser?

    nope.... it would need a name in order for it to work.... and even if you did click it, since it isn't a link, button or some other clickable item,..... I doubt it would do anything.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * 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??? *

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Isit possible to click just text in webbrowser?

    Sure you can click on it....it probably won't do anything, but you can click away.

    I suspect that if you opened the page in IE or FireFox or some other browser, and clicked on the text, it wouldn't do anything either.

    What is it that you want to have happen AFTER you have clicked on it?

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Isit possible to click just text in webbrowser?

    But don't you need to referr to it by it's NAME attribute? Or its ID attribute.... I mean if it's some random text, not contained within any other context.... ????

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * 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??? *

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Nov 2008
    Posts
    177

    Re: Isit possible to click just text in webbrowser?

    1) It is a link!
    2)@hack , how could i click on it? I think you mean just click on it myself i mean the program click on it..
    3)@techgnome, that is my question

  6. #6
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Isit possible to click just text in webbrowser?

    you can loop through all the links then click if the innertext value matches
    use something like
    vb Code:
    1. for each ele in web1.document.getelementsbytagname("A")
    2.    if ele.innertext = "whatever" then ele.click: exit for
    3. next
    not tested
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Nov 2008
    Posts
    177

    Re: Isit possible to click just text in webbrowser?

    Quote Originally Posted by westconn1
    you can loop through all the links then click if the innertext value matches
    use something like
    vb Code:
    1. for each ele in web1.document.getelementsbytagname("A")
    2.    if ele.innertext = "whatever" then ele.click: exit for
    3. next
    not tested
    aha it worked

    Thanks alot.

    Im learning quite alot of these forums

Posting Permissions

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



Click Here to Expand Forum to Full Width