Delete File Activity Not Working

The Bot Process:

  • Logs into a web app
  • Grabs a transaction
  • Scrapes data
  • Creates an xls file
  • Saves it locally
  • Attaches the xls to the web app using an add file feature
  • Then deletes file
  • And then the bot grabs the next transaction and repeats the above steps.
    Issue:
    This code works perfectly with version 2018.1 but when upgrading to 2018.4 the delete fails. It looks like the Browser has some sort of hook in the file not allowing the process to delete it. When I close the browser the file does disappear. So the delete is sort of waiting for the browser to release the file.

I cannot close the browser between transactions.

Tried:

  • Killing the excel process before the delete
  • Closing the workbook
  • Using autosave
  • Using save activity
  • Invoke method for garbage collection

Can you refresh the page in the browser before next or not?

I guess it is taking time to upload the file add some delay then try to delete the file.

Browser refresh was a good idea but it did not work. I got around the issue by using unique file names. The browser process still holds the file until the browser closes, then the file is released and deleted.

Yeah, delay was one of the first things I considered, however, that has no affect as the browser process is happy to hold on to the file forever. I got around the issue by using unique file names. The browser process still holds the file until the browser closes, then the file is released and deleted.