How to get storedVars array in selenium soda test?
I expect that storeEval puts variable with given name to array storedVars. But storedVars is undefined. Or maybe I don't know in what scope I can access it.
var soda = require('soda')
, assert = require('assert');
var browser = soda.createClient({
host: 'localhost'
, port: 4444
, url: 'http://jquery.com'
, browser: 'firefox'
});
browser.session(function(err){
browser.open('/', function(err, body, res){
browser.storeEval(" window.jQuery('.logo').height();", "height", function(err, body, res){
// ---------------------------------------------------------------
// how to get storedVars['height'] here?
// ReferenceError: storedVars is not defined
// ---------------------------------------------------------------
console.log ("height: "+storedVars['height'] );
if (err)
{
throw err;
}
browser.testComplete(function(){
});
});
});
});
Using your example above, you can access storedVars like this:
var soda = require('soda')
, assert = require('assert');
var browser = soda.createClient({
host: 'localhost'
, port: 4444
, url: 'http://jquery.com'
, browser: 'firefox'
});
browser.session(function(err){
browser.open('/', function(err, body, res){
browser.storeEval("window.jQuery('.logo').height();", "height", function(err, body, res){
browser.getEval('${height}',function(err,val){
if(err !== null) throw err
console.log(val)
browser.testComplete(function(){ });
});
});
});
})
One thing is to make sure not to call testComplete before you get them though!