![](/img/trans.png)
[英]Accessing Selenium IDE variables form javascript code inside a rollup?
[英]Accessing Javascript global variables from Selenium IDE
我正在使用最新的Selenium IDE 2.2.0,
並且嘗試訪問在腳本中設置的javascript全局變量時遇到麻煩。
這個變量充當成功標志,所以我把
Command: waitForCondition
Target: test
Value: 2000
但是我明白了
[error] test is not defined
我試着用Selenium IDE查看Access JavaScript變量 ,替換
Target: this.browserbot.getUserWindow().test
但我也得到
[error] this.browserbot is undefined
我可以嘗試使用其他方法來設置成功標志,例如拋出警報,但是我想知道如何訪問我的javascript變量。
該文檔提到了storedVars,但這僅適用於存儲在硒中的變量,因此我處於機智。
我四處張望,發現以下文檔
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.
所以
window.test
作品!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.