学以致用,个人觉得要学老外的东西,最好的方法就是自己翻译一遍。因此准备把SIDE官网的一些文档,按工作所需做些翻译整理。本文是命令这一块的提纲,未全部完成,占坑中。
Selenium IDE中的命令其实就等同于编程语言中的函数,这是首先要建立的一个概念。
函数是一个小的功能单元,每个函数都有自己目的,实现一个具体的功能,函数有入参、有出参。
要想用SIDE完成日常测试工作中各种场景的需求,就得熟练掌握这些命令,并灵活运用。
而要学会这些命令,前期得多看文档,看看每个命令的作用是什么、传什么参数,输出什么结果。
对于Web测试来说,对Web前端知识要求还是有点高,要了解HTML(标签、id、class、属性等)、CSS(元素选择器selector)、Javascript/DOM、XML(xml、节点、元素、属性、xpath等)
Selenium IDE 目前的版本 3.6 系列,有94个内置命令。这些可以分为如下几类:
大类 |
小类 |
命令列表 |
工具类 |
- |
- pause
- set speed
- run
- echo
- debugger
|
交互操作 |
窗口 |
- close
- select frame
- select window
- set window size
|
页面 |
- open
- run script
|
表单 |
- add selection
- check
- edit content
- remove selection
- select
- submit
- type
- uncheck
|
弹框 |
- answer on next prompt
- choose cancel on next confirmation
- choose cancel on next prompt
- choose ok on next confirmation
- webdriver answer on visible prompt
- webdriver choose cancel on visible confirmation
- webdriver choose cancel on visible prompt
- webdriver choose ok on visible confirmation
|
鼠标 |
- click
- click at
- double click
- double click at
- drag and drop to object
- mouse down
- mouse down at
- mouse move at
- mouse out
- mouse over
- mouse up
- mouse up at
|
键盘 |
- send keys
|
流程控制 |
流程类 |
- do
- if
- else
- else if
- end
- repeat if
- while
- times
|
控制类 |
- wait for element editable
- wait for element not editable
- wait for element not present
- wait for element not visible
- wait for element present
- wait for element visible
|
变量类 |
- store
- store attribute
- store text
- store title
- store value
- store window handle
- store xpath count
- execute script
- execute async script
|
断言类 |
非阻断型 |
- verify
- verify checked
- verify editable
- verify element present
- verify element not present
- verify not checked
- verify not editable
- verify not selected value
- verify not text
- verify selected label
- verify selected value
- verify text
- verify title
- verify value
|
阻断型 |
- assert
- assert alert
- assert checked
- assert confirmation
- assert editable
- assert element present
- assert element not present
- assert not checked
- assert not editable
- assert not selected value
- assert not text
- assert prompt
- assert selected value
- assert selected label
- assert text
- assert title
- assert value
|