Forum Discussion

RK3's avatar
RK3
Occasional Contributor
2 years ago

Getting an access is denied while deleting the file from the folder in c drive using testcomeplete

function deleteFile(){
aqFileSystem.DeleteFile("C:\\Program Files (x86)\\testing\\delete\\new.txt")
}

 

details of the logs:

 

Access is denied.
 Path: C:\Program Files (x86)\testing\delete\new.txt
 
Test log message: An error occurred while deleting a file(folder)
 
while deleting manually there is pop up showing on the window (user Account control): Do you want to allow this app to make changes.
If i click yes it will delete the file but i want to do it using the TestComplete. Is it possible to do that? 
 
Note: when Test complete is executed in admin mode file got deleted without error but i want to delete the file without changing the Test complete to admin.
Any suggestions please?
 

19 Replies

  • RK3's avatar
    RK3
    Occasional Contributor

    i am unable to delete file from the folder getting An error occurred while deleting the file(folder) used 

     

    aqFileSystem.DeleteFile(file true); 

      • RK3's avatar
        RK3
        Occasional Contributor

        no File is not open or in use i can delete manually

        but with testcomplete giving the error

    • rraghvani's avatar
      rraghvani
      Champion Level 3

      Can you post your code please? I would like to see the fully qualified path name of the file you are trying to delete, and a screenshot of the exact error message

  • If it is possible, you can just launch TestComplete / TestExecute in administrator mode

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Is this the same/similar issue that you posted in https://community.smartbear.com/t5/TestComplete-Questions/unable-to-delete-file-using-testcomplete/td-p/248809 ?

     

    UAC aims to improve the security of Microsoft Windows by limiting application software to standard user privileges until an administrator authorises an increase or elevation. In this way, only applications trusted by the user may receive administrative privileges and malware are kept from compromising the operating system. In other words, a user account may have administrator privileges assigned to it, but applications that the user runs do not inherit those privileges unless they are approved beforehand or the user explicitly authorises it.

     

    Either disable UAC, or store the file in a different location which you have permissions.

     

    See Working With TestComplete Under User Accounts