Not able to see file uploaded successfully

Hello team I am trying to write a synthetic script to upload a file. After clicking the browse button I need to upload the file from my local machine. I tried writing the below code snippet. But it Does not work. Can you please help me with this

var fs = require(‘fs’);
var crypto = require(‘crypto-js’);
return new Promise(function(resolve, reject){
fs.writeFile(’/tmp/pic.jpg’, crypto.randomBytes(64).toString(‘hex’), function(err){
if (err) reject(err);
else resolve(“abcd”);
return $browser.waitForAndFindElement({xpath:"//em//button[text()=‘Browse…’]"},50000).then(function(elem2){
}).catch(function(err) {
console.log(“error here: " + err);

Need to click on browse upload the document

Hi @ashna.gupta1 Can you share the permalink to your Synthetics monitor which has the above script? I’d like to understand the error it is throwing when using this script.