i am using browser javascript package for getting values from website..The script is running fine it is printing data in console but i want the return value in outcome variablel of automation anywhere..i have tried return value in function then also it didint work...i have set the outcome variable but it didnt work..can anybody know how to get output of javascript in the outcome variable??plz help
Hi
Please try with below sample code
function extractDataFromPage() {
var data = document.getElementById('someElementId').innerText;
return data;
}
- Execute JavaScript in Web Page command to run the script.
- Use "Assign" command to store the returned value in an A360 variable.
Even I'm facing same issue can you take live website extract a single value and share us the code and website url
In the Browser: Run JavaScript action, use the following format for returning a value:
//call the function (must be first)
getTitle();
//define the function
function getTitle() {
return document.title;
}
Notice I am calling the function before it is defined. If you call it after, it will fail.
In this case, this simple function returns the title of the web page. You can have it return other values as well. Note that multiple values will have -1, -2, -3, etc., appended to the variable name. $myVariable$ will be the first value, $myVariable-1$ will be the second, etc.
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.