|
-
Dec 22nd, 2008, 12:45 PM
#1
Thread Starter
Addicted Member
[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:
webbrowser1.document.all("Iamsomerandomtext").click
Sorry if this is just impossible
-
Dec 22nd, 2008, 01:12 PM
#2
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
-
Dec 22nd, 2008, 01:14 PM
#3
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?
-
Dec 22nd, 2008, 01:27 PM
#4
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
-
Dec 22nd, 2008, 01:35 PM
#5
Thread Starter
Addicted Member
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
-
Dec 23rd, 2008, 03:06 AM
#6
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:
for each ele in web1.document.getelementsbytagname("A") if ele.innertext = "whatever" then ele.click: exit for 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
-
Dec 23rd, 2008, 08:26 AM
#7
Thread Starter
Addicted Member
Re: Isit possible to click just text in webbrowser?
 Originally Posted by westconn1
you can loop through all the links then click if the innertext value matches
use something like
vb Code:
for each ele in web1.document.getelementsbytagname("A")
if ele.innertext = "whatever" then ele.click: exit for
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|