Get the correct path of the last uploaded file

hello community testproject
I ask for help
I try to get the path of the last downloaded file using the action Get path of latest downloaded file and get C: \ users … apk.crdownload but the real path is C: \ users … apk how to write the path without .crdownload to the variable?
thanks for the hint!

seems its counting the chrome download as the file, may want to adaptive wait and a get command. or could use repeating ‘test’(i prefer to think of these as functions),
get path of download file,
regex out directory and get the .apk and everything afterwards
count the letters
if count not equals 3 then wait x period of time

Then id loop it a sensible amount
ie if you x period of time is 30 seconds, then maybe loop 10 times, dependanto n how big fiel is and how long takes on average

1 Like

thanks for the help, this option seems difficult for me. I want to try in the resulting variable to delete everything after the .apk using regex

So first we have to get your path of last
C:\My Drive\reports.apk.crdownload
We store this in a parameter ie {downloadFile}
Next we use regex to extract the before part of path so get left the name.apk.crdownload
(I am assuming your file name will have a known value)
Next add the extract regex step:

Should do the job

|(didnt reset my value to C:\ before screen shot but doesnt matter the regex doesnt care)
You can then store the output how you like, to be honest, i store it in same parameter as I can do this)
Next we want to do a Length check on the output on the regex.

this will give you an output number
In mine it output 22, so we can then use basic thinking that .crdownload == 11 so 22 - 11 == 11
Now we can build a step that is a basic loop.
Screenshot 2021-11-10 at 10.20.50
now to get it to repeat:

Lets convert it into a “test” aka a function
Screenshot 2021-11-10 at 10.22.13
With the loop created you can now add a condition,
{downloadLength} >= 11 ( or expected file name length}
(whoops screen shotted lessThanOrEqual, Is meant to be GreaterThan

Now a note in the loop function you just made you may want to make have a condition on pause that check a project parameter for the length value ( i used test value) as if you download complete it will carry on looping other wise.

But this is most the framework mapped out so you can start tweaking and evolving it to meet your needs

1 Like

thanks for the answer
but i tried another solution .*.apk and it works too. We still need to figure out how to check that the file has already been downloaded to the computer and is available for uploading to the testproject account. You can also check every 5-10 seconds the line for the presence of .crdownload, and as soon as the path to the file becomes correct, continue the test execution.

This topic was automatically closed after 180 days. New replies are no longer allowed.