Skip to main content
Solved

Run Javascript in browser

  • May 14, 2023
  • 2 replies
  • 1310 views

Forum|alt.badge.img+1

Hello, Can anyone describe what is the correct way to pass variable in the run javascript action from the javascript package in A360. 

I am trying to read the filed value of an input element from browser but not able to get the output.

 


 



 

 

Best answer by BeauG107806

Howdy. I had the same problem. I solved it by putting the function and its variables into a string, writing it to file, then calling the file using the Javascript in browser. Works a treat. Like this;

 

 

2 replies

Forum|alt.badge.img+4
  • Navigator | Tier 3
  • 15 replies
  • Answer
  • May 14, 2023

Howdy. I had the same problem. I solved it by putting the function and its variables into a string, writing it to file, then calling the file using the Javascript in browser. Works a treat. Like this;

 

 


Forum|alt.badge.img+1
  • Author
  • Cadet | Tier 2
  • 1 reply
  • May 15, 2023

@BeauG107806 Thanks for the approach. I am using this way to write this snippet in the file and then call it 
function getFieldValue () {var field = document.querySelector("#id");return field.value;}

Now it is completing without any error but the output returned is also an empty value.
Same snippet I use it in the console of the browser it gives the desired output. 

Any specific form of encoding that I need to save the file, in the log to file command?