Selenium 是 thoughtworks公司的一个集成测试的强大工具。学习文档在http://seleniumhq.org/docs/
- Selenium IDE:(参考:http://www.uml.org.cn/Test/200910166.asp)
- Selenium IDE的安装很简单,如果使用Firefox
2.0,可以直接将官网上下载的文件(例如selenium-ide-1.0-beta-2.xpi)置于Firefox安装路径下的extensions文件夹(默认安装路径C:\Program
Files\Mozilla Firefox\extensions,而Firefox1.5的默认路径在C:\Program Files\Firefox
Plus\App\firefox\extensions)下,然后关闭当前打开的Firefox窗口,重新打开即可执行自动安装。
- Selenium IDE 常用命令:
Selenium commands come in three“flavors”:
Actions:commands that generally manipulate the state of the
application
Accessors:examine the state of the application and store the results in
variables,They are also used to automatically generate
Assertions.
Assertions: verify that the state of the
application conforms to what is expected.All Selenium Assertions can be used in 3 modes: “assert”, “verify”, and ”
waitFor”. 举例:
open:opens a page using a URL. click/clickAndWait:performs a click operation, and optionally waits for a new page to load. verifyTitle/assertTitle:verifies an expected page title. verifyTextPresent:verifies expected text is somewhere on the page. verifyElementPresent:verifies an expected UI element, as defined by its HTML tag, is present on
the page. verifyText:verifies expected text and it’s corresponding HTML tag are present on the page. verifyTable:verifies a table’s expected contents. waitForPageToLoad:pauses execution until an expected new page loads. Called automatically when
clickAndWait is used. waitForElementPresent:pauses execution until an expected UI element, as defined by its HTML tag,
is present on the page. 3.模式匹配:There are three types of patterns: globbing, regular expressions, and exact.
下载地址:http://seleniumhq.org/download/ 下载Selenium Server (formerly the Selenium RC Server) |