views:

45

answers:

1

I want to do this in selenium: var variable = editors; if (typeof(variable) == "undefined") {}; but I am not entirely sure how to do it with the getEval() method.

+2  A: 

Since you have not mentioned where editors is coming from I am going to assume that it is on the page. var win = this.browserbot.getUserWindow(); will give you access to window.

selenium.getEval("var win = this.browserbot.getUserWindow();var variable = win.editors; typeof ( variable) === 'undefined';");

*Edit from comment*

browserbot is the JavaScript object that Selenium uses to control the internals of the browser. It is the object that controls the window. What you can do in Selenium you can do in BrowserMob. So go into the advanced scripting of your script and then put

 var resultFromEval = selenium.getEval("var win = this.browserbot.getUserWindow();var variable = win.editors; typeof ( variable) === 'undefined';");
AutomatedTester
ok... hmm... do you know how you would do that with browsermob? because I have never seen browserbot before.
chromedude
I have updated my answer
AutomatedTester