deathtaker26 Posted March 23, 2011 Author Share Posted March 23, 2011 hi i'm writing a program for my job and in doing so I've reached a problem. I need to know how to select text inside a web browser kinda like using ctrl + f to find something. the reason i can't just use ctrl + f is because the program has to search for key words on it's own then click the link that the selected text takes them too. It's kinda like a spider. Can someone please help me out with this? Link to comment Share on other sites More sharing options...
Homicidal Monkey Posted March 24, 2011 Share Posted March 24, 2011 you could just use sockets to download the website as a string and search that. Link to comment Share on other sites More sharing options...
deathtaker26 Posted March 24, 2011 Author Share Posted March 24, 2011 that is what im doing. But the elements im getting don't have an id only a class and i can't find by class and i need it to extract the link of the anchor. and I also need it to see it's position on the page as well so yeah >_< Link to comment Share on other sites More sharing options...
cheatking Posted March 24, 2011 Share Posted March 24, 2011 Regular expressions. Link to comment Share on other sites More sharing options...
Homicidal Monkey Posted March 24, 2011 Share Posted March 24, 2011 ![](http://imgs.xkcd.com/comics/regular_expressions.png) Link to comment Share on other sites More sharing options...
deathtaker26 Posted March 24, 2011 Author Share Posted March 24, 2011 Okay I have never heard of regular expressions I have just researched it and from what I understand it just searches for things by patterns and whether they are like numeral or alphabetic. But this program has to find the PERFECT parts of it. I'm being payed a lot of money for this and they need everything 100% perfect meaning 0 bugs and because the program visits 1000's of different pages it would be hard to take out specifics such as patterns to point things out cause each page has a different html source. Link to comment Share on other sites More sharing options...
cheatking Posted March 24, 2011 Share Posted March 24, 2011 @Crest:> Okay I have never heard of regular expressions I have just researched it and from what I understand it just searches for things by patterns and whether they are like numeral or alphabetic. But this program has to find the PERFECT parts of it. I'm being payed a lot of money for this and they need everything 100% perfect meaning 0 bugs and because the program visits 1000's of different pages it would be hard to take out specifics such as patterns to point things out cause each page has a different html source.If your being payed allot of money they assume you now this stuff…Use regular expressions, it's the only real way. http://gskinner.com/RegExr/ Link to comment Share on other sites More sharing options...
deathtaker26 Posted March 24, 2011 Author Share Posted March 24, 2011 @Mr.:> If your being payed allot of money they assume you now this stuff…> Use regular expressions, it's the only real way. http://gskinner.com/RegExr/well what I was doing was using parts that are similar within all the sources of every page on yellowpages.com here just look for yourself``` // Gets Page Source string source = Functions.RetrieveSource(webBrowser1.Url.ToString()); //Collects Company Phone Number int StartInd = source.IndexOf("") + 17; int EndInd = source.IndexOf("" ) - 4 ; source = source.Substring(StartInd, source.Length - StartInd);I'm actually working on this part now it's why it's not done….``` Link to comment Share on other sites More sharing options...
Homicidal Monkey Posted March 24, 2011 Share Posted March 24, 2011 why are you using a web browser object? Link to comment Share on other sites More sharing options...
deathtaker26 Posted March 24, 2011 Author Share Posted March 24, 2011 The web browser is just so I can see what it's doing when I'm done it won't even be on the program. I'm using it to see the page as it scrapes data. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now