I'm using the latest Selenium IDE 2.2.0,
and I'm having trouble trying to access a javascript global variable that I set in my script.
This variable acts as a success flag, so I've put
Command: waitForCondition
Target: test
Value: 2000
But I get
[error] test is not defined
I've tried looking at Access JavaScript variables with Selenium IDE , replacing
Target: this.browserbot.getUserWindow().test
but I also get
[error] this.browserbot is undefined
I could try a different method of setting a success flag like throwing out an alert, but I'd like to know how to access my javascript variables.
The docs mentioned storedVars, but that was only for variables stored in selenium so I'm at my wits' end.
I looked around a bit more and found the following documentation for
Command: waitForEval
Note that, by default, the snippet will run in the context of the "selenium" object
itself, so this will refer to the Selenium object. Use window to refer to the window
of your application, e.g. window.document.getElementById('foo')
If you need to use a locator to refer to a single element in your application page,
you can use this.browserbot.findElement("id=foo") where "id=foo" is your locator.
And so
window.test
works!
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.