在这里积累学习中的点点滴滴!

发布新日志

  • RFS 下拉列表默认值检查以及选择

    2018-03-20 11:18:02

    WEB中的下拉框比较常见,以下是对下拉框的初步尝试操作:
    1、进入新增页面,点击新增按钮,检查页面下拉框的默认选项为【女】
    2、输入姓名、年龄、电话
    3、下拉框选择课程信息

     [Arguments]    ${name}    ${age}    ${phone}
        click element    xpath=.//li[@id='SignUp']    #点击学员报名菜单
        click element    xpath=.//a[@class='tt_btn tt_right']    #点击新增按钮
        Page Should Contain Element    xpath=.//select[@id='Gender']    #进入新增页面
        List Selection Should Be    xpath=.//select[@id='Gender']    女    #检查默认性别为女
        input text    xpath=.//*[@id='RegistrationName']    ${name}    #输入姓名信息
        input text    xpath=.//*[@id='Age']    ${age}    #输入年龄信息
        input text    xpath=.//*[@id='RegistrationPhone']    ${phone}  
        List Selection Should Be    xpath=.//select[@id='PeriodId']    请选择
        Select From List by index    xpath=.//select[@id='PeriodId']    1    #选择课程
        sleep    1
        click button    xpath=.//*[@type='submit']
        Page Should Contain Element    xpath=.//a[@class='tt_btn tt_right']
  • RFS table元素定位方式

    2018-03-20 11:15:59

    以下脚本功能是删除表格中的一行数据,name变量是要删除的文字描述,

    1、到表格页面
    2、找到name名称的文字,并点击对应的删除按钮
    3、弹出确认删除提示框,点击确认
    4、删除成功后提示一个删除成功的alert点击确认
    5、检查页面是否有岗位文字信息

    删除岗位
        [Arguments]    ${name}
        进入岗位管理页面
        click element    xpath=.//tr[contains(text(),${name})]//a[@title='删除']
        page should contain    您确定要删除本记录吗?
        click element    xpath=.//*[@class='ui-dialog-buttonset']
        sleep    1
        Choose Ok On Next Confirmation
        confirm action
        page should contain    岗位
     
  • 第一个APP测试脚本-登录

    2018-03-09 15:09:51


    做测试,对于工具的初步了解第一个尝试的脚本肯定是登录了,先上脚本
    1、打开app检查页面是否有【我的】文字信息
    2、点击【我的】tab,检查页面有【未登录】文字信息
    3、点击【未登录】进入登录页面
    4、输入账号【18700000000】

    登录
        open application    http://localhost:4723/wd/hub    platformName=Android    platformVersion=4.2.2    deviceName=10.0.1.128:5555    app=${CURDIR}/xxxx.apk
        sleep    3s
        Wait Until Page Contains Element    xPath=//android.view.View[@content-desc='我的']
        click element    xPath=//android.view.View[@content-desc='我的']
        Wait Until Page Contains Element    xPath=//android.view.View[@content-desc='未登录']
        click element    xPath=//android.view.View[@content-desc='未登录']
        input text    xPath=//android.widget.EditText[@index='0']    18700000000

    注意事项:
    1、open application 关键字用于打开app,如果未安装则根据配置路径安装app并打开。
    2、使用UI Automator Viewer工具可以查看APP页面中的元素便于定位,"C:\Program Files (x86)\Android\android-sdk\tools\uiautomatorviewer.bat"。
    3、APP中常用的content-desc属性,可以在脚本中当作name,id属性直接使用。
    4、元素属性识别大小写,当时就因为定位文本框时index首字母大写了导致花费了很多时间排查问题。



Open Toolbar