*** Settings ***
Resource MyResource.txt
Library Selenium2Library
Library BuiltIn
Library Screenshot
Library Collections
*** Variables ***
${hello} 欢迎使用ride工具
@{student} 123 456 789 # 学生名字
*** Test Cases ***
自动退款
Open Browser http://02.aweb.test.51jk.com/admin/order/order_list browser=ie
Sleep 10
Unselect From List By Value id=trades_status 120
Click Button id=search_btn
Sleep 5
123
#builtin库 更多详见http://blog.chinaunix.net/uid-20393955-id-3074760.html
${a} Set Variable i am a beautifull girl
log ${a}
${hi} Catenate hello world
log ${hi}
${abc} Create List a d f
log ${abc}
${t} Get Time hello world
log ${t}
${b} Set Variable 59
Run Keyword If ${b}>90 log 优秀
... ELSE IF ${b}<=70 log 良好
: FOR ${i} IN RANGE 10
\ log ${i}
@{ddd} Create List d d d
: FOR ${i} IN @{ddd}
\ log ${i}
${d} Evaluate random.randint(1000,9999) random
log ${d}
Import Library E:/python/123.py
${c} Evaluate int(4)
${d} Evaluate int(5)
${add} add ${c} ${d}
log ${add}
Comment 这是注释
Take Screenshot #截取当前屏幕,Screenshot库
#Collections库
#创建字典
Create Dictionary key value key value
${dict} Create Dictionary 1 hello 2 nice to meet you
${itmes} Get Dictionary Items ${dict}
log ${itmes}
#Get Dictionary Items #关键字获取字典中的key和value
#Get Dictionary Keys #关键字获取字典中的key
#Get Dictionary Values #关键字获取字典中的value
#Get From Dictionary #获取字典中key对应的value
log 我是小剑剑 ${hello}
: FOR ${n} IN @{student}
\ log ${n}
Input Text id=site_id 你好 #输入文本
Click Element id=site_id #点击元素
Click Button id=site_id #点击按钮
Wait Until Page Contains Element id=site_id 42 error #42 是等待时间,error 是错误提示
Get Title #获取标题
Get Text id=site_id
Get Element Attribute id=site_id@name #获取元素属性,@name获取这个元素的name
#验证
Open Browser http://www.baidu.com ie
${title} Get Title
Should Contain ${title}
百度一下,你就知道
${text} Get Text
Should Contain ${text} 百度一下,你就知道
#表单嵌套 #有时候页面会出现表单嵌套
Select Frame id=site_Id
Unselect Frame #退出表单
Unselect From List By Value id=site_id value #下拉框选择
Execute Javascript $("#tooltip").fadeout(); #执行JavaScript代码
铁素体
search_test 百度一下 百度一下
search_test 你好 hello
search_test 你可以百度一下 百度一下,你就知道