I am using imacros to code in javascript and i cant seem to retrieve variables from the website pages javascript.
In the javascript for the page the variable is window.vVals = (variable value here)
I need to get that using imacros, how would i do that? I have tried various things window.vVals vVals window.content.vVals But they all return undefined, its really frustrating now
Thanks
Edit:
<script>
window.vVals = {
'f': 'frm_sample',
'n': '57064044135dd',
'a': '57067289aa2c6'
};
</script>
The above is the code that is on the web page
Using IMacros i would like to retrieve the values of those variables (the values change everytime you refresh which is why i cant use any 1 value)
Below is one of the possible solutions:
iimPlayCode('SEARCH SOURCE=REGEXP:"(window\\\\.vVals = ((\\\\s|.)*?);)" EXTRACT=$2');
var vVals = JSON.parse(iimGetExtract().replace(/'/g, '"'));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.