View Single Post
Old 05-7-2012, 08:32 AM   #27
UserNameGoesHere
FFR Veteran
FFR Veteran
 
UserNameGoesHere's Avatar
 
Join Date: May 2008
Posts: 1,114
Send a message via AIM to UserNameGoesHere
Default Re: [JAVA] Site Search Help

Here is what your code does. Note, your code assumes you already have Firefox open AND that you already have the desired URL page loaded once. It also assumes Alt Tabbing will get focus to Firefox.

Switch focus over to Firefox.
Open and read the site, looking for specific things, exiting if they are found.
If they're not found, refresh the page in Firefox and try again.

Problem is, since the page is dynamically-generated, the page your program parses and the page Firefox loads may not be the same. There is no connection between your Robot code (which scripts the refreshing of Firefox) and your parsing code.

What you have is known as a race condition. Basically, if it works, it's only lucky that it worked. You are banking on the two accesses (once by your program, once by Firefox) to be close enough together such that the randomizer on the site will "randomize" identical results. If the site based randomization on access rather than time, you would almost never get correct results.

The code I presented has no such race conditions and accesses the site only once per round, feeding the results directly into a new tab in firefox.
__________________
Quote:
Originally Posted by Crashfan3 View Post
Man, what would we do without bored rednecks?
[SIGPIC][/SIGPIC]

Last edited by UserNameGoesHere; 05-7-2012 at 08:36 AM..
UserNameGoesHere is offline   Reply With Quote