Your data. Anywhere you go.

New Relic for iOS or Android


Download on the App Store    Android App on Google play


New Relic Insights App for iOS


Download on the App Store


Learn more

Close icon

How to browse and upload photos from local folder

synthetics-script

#1

Hi,

How can we browse and upload a photo from local folder.

example - I wanted to upload a pic to facebook from local folder. Please guide me.

Thank you in advance.


#2

Hi, @csingapanga: To upload a file in Selenium Webdriver, locate the filename input element, and use the sendKeys() function to enter the file name.

The challenge will be getting the file you wish to upload into the local file system of the Synthetics minion. You will either have to create the file in your script, or download it from somewhere on the web.


#3

Until script part, everything is okay! but I need a local file system to browse photos.

Does newrelic has any local directory to save 2 or 3 images and browse from that location.


#4

No, I do not know of any way to add files to the local file system of a Synthetics minion.


#5

The post below describes how to read a file from a remote location. Perhaps you can utilise this as part of your script @csingapanga


#6

Hi @csingapanga let us know if Stefan’s post helped. For storing locally, the only way to do this from Public Locations is to Download the file from the web first then it can be accessed.

With a Containerized Private Minion you could mount a local volume to the Docker container to access it, you can also load custom NPM modules to use within the script so that might be useful :slight_smile: https://docs.newrelic.com/docs/synthetics/new-relic-synthetics/private-locations/containerized-private-minion-cpm-configuration


#7

Hi @rdouglas

I have a similar question. I need to access and read files in /tmp directory in the host where I have my containerized private minion. As you suggested, I have mounted the /tmp directory to the docker container. However, I am getting an error that the “file does not exist” even though there is file with full permissions. When I simply check for /tmp directory… it is able to identify the directory, but not file I specified.

Can you please help me understand what might be going wrong in this case.


#8

@vamsi.matta Scripted and Browser monitors get launched by the CPM in separate “runner” containers. So although /tmp is mounted to the CPM, the runner containers are launched to receive an isolated portion from this mount, which is why the file doesn’t exist during runtime when you try to access it in a script. To meet this use case though, I would recommend using the custom NPM modules directory that you can mount. I describe how leverage this for including file fixtures for your scripted monitors in the following post: