I am building out tests cases in Studio that navigate file explorer to upload a specific file from an “Images” folder within the project. When I publish these tests to Orchestrator, the images aren’t found since the navigation is different. How should I go about handling this? When a project is published, is there somewhere that these images are stored on the server(automation suite on prem) that the bot can access?
Put your Images folder inside your UiPath projet
Use this single line to get the correct path at runtime:
filePath = System.IO.Path.Combine(Environment.CurrentDirectory, “Images”, “YourFileName.png”)
When you publish a project, your Images folder is included inside the package, but it is NOT stored on the Orchestrator server in a browsable location.
Instead, when a job runs, the package is extracted into a temporary working directory on the robot machine — and that is where the files exist at runtime.
So you cannot use File Explorer navigation with fixed paths, because the path changes after publishing.
Try this solution
Use a relative project path, not an absolute Windows path.
Path.Combine(Environment.CurrentDirectory, “Images”, “myfile.png”)
C:\Users\<RobotUser>\.nuget\packages\<YourPackage>\<version>\contentFiles\any\any\Images\
and Environment.CurrentDirectory automatically points to that folder during execution.
This works both before and after publishing because UiPath extracts your package like:
Cheers
That’s not the correct way to do this. You don’t UI automate in file explorer. You just use file paths to copy/move files, upload them to storage buckets, etc.
You shouldn’t put folders like this inside the project. Folder for data storage should be outside the project.
They are still stored under the project folder but you’re using full paths instead of relative paths and that’s why it’s breaking. But again, you shouldn’t be putting a folder like this inside the project folders.
Why should I not use a folder in the project? This is for UI test automation, not a process. Part of the testing involves a user uploading an image from the UI so I’m not sure how else to do this. I don’t have access to the server.
This worked! Thank you
For exactly the reason you’re experiencing problems. The data/files publish with the project, meaning the file locations change. Also, having them publish with the project means you can’t change the data/files without re-publishing the project.
Do you mean the user specifying a file to a running attended automation? What does “a user uploading an image from the UI” mean, in detail?
If the file locations are changing, wouldn’t using a relative path to the folder/file eliminate the issue I’m seeing? I have a team of testers who will pull the latest version from source control and update as needed, so having these files stored within the project seems like the right approach. Please correct me if I’m wrong.
This is UI test automation in an unattended mode. The bot is running through UI validation and verification in an end to end test. Part of that validation requires a bot to upload an image(static file that doesn’t change) and verifies the image upload is successful and the verbiage displays in the UI.
That upload process is as follows:
-Click upload button in app UI>file explorer opens
-Enter relative path to file
-Click ok
-Verify filename and image added successfully text displays in UI
Yes. Instead of “C:\somefolder\yourproject\images\imagename.gif” you’d just use “\images\imagename.gif”
But again, generally you don’t want data/files stored inside the project because then you can’t change them without republishing the project.
u can use deterministic path
path=Path.combine(enviroment.currentDictionery,“images\file.png”)
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.