Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Missing output files after running task iteratively  RSS feed

 
Shachen Han
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello.

I am using Selenium WebDriver to perform some webscraping. Based on the website URL given by the user, Selenium will bring up the website, and take a screenshot.

I've also added an interval feature, such that every 1 minute or whatever timing the user has selected, the script will re-visit the website again and take a screenshot.

All these output are saved to a directory specified by the user.

The first time round I run it is fine. I received my screenshot in the directory I specified.
After 1 minute, the script will start up again and everything seems to be running normally, but the directory is missing the additional screenshots.

What am I missing here?



I'm using the NetBeans GUI Builder for my form.

 
Tim Cooke
Marshal
Posts: 3963
234
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any errors in your log?
 
Shachen Han
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm, the logger isn't throwing any errors.
 
Campbell Ritchie
Marshal
Posts: 56225
171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
… and welcome to the Ranch

Moving thread as too difficult for this forum.
 
J. Kevin Robbins
Bartender
Posts: 1801
28
Chrome Eclipse IDE Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you'll find that you are getting the screen capture, but it's overwriting the previous file. Consider for a moment; how often is your datetime String changing?
 
fred rosenberger
lowercase baba
Bartender
Posts: 12559
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never be afraid to increase logging. Why not have it write to the log file something like this every time you save a file:

2015-10-07 08:00:00 - Saving file <print the full path and file name here>

Then you can see if you are overwriting the same file each time or not.
 
Shachen Han
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:… and welcome to the Ranch

Moving thread as too difficult for this forum.


Glad to be here


J. Kevin Robbins wrote:I think you'll find that you are getting the screen capture, but it's overwriting the previous file. Consider for a moment; how often is your datetime String changing?


You're right, I can't believe I overlooked that... It works fine now that I placed it into my method. Thanks for the help!

 
J. Kevin Robbins
Bartender
Posts: 1801
28
Chrome Eclipse IDE Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glad you fixed it! Always keep your variable scope as limited as possible.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!