Access JavaScript variables with Selenium IDE

Posted by kRON on Stack Overflow See other posts from Stack Overflow or by kRON
Published on 2009-09-14T08:53:56Z Indexed on 2010/03/22 15:21 UTC
Read the original article Hit count: 680

Filed under:
|

I'm wondering if it's possible to access page JavaScript variables with Selenium. I have an application that's using a variable attached to the window object. It has a global scope and I can access it either with window._myvar, window['_myvar'], _myvar, this['_myvar'], this._myvar depending on the context.

So I tried to get Selenium to echo it. As far as I understand, in Selenium IDE the context in which everything runs is selenium. I tried doing this.browserbot.getCurrentWindow()._myvar, this.browserbot.getCurrentWindow()[_myvar] to no avail. I get bumped with the following error Unexpected Exception: message -> eval(match[1]) is undefined.

Anyone managed to access their page's JavaScript?

© Stack Overflow or respective owner

Related posts about selenium

Related posts about JavaScript