zoukankan      html  css  js  c++  java
  • robot framework Selenium2关键字介绍


    *** Settings *** Library Selenium2Library *** Keywords *** Checkbox应该不被选择 [Arguments] ${locator} Checkbox Should Not Be Selected ${locator} Frame应该包含文本 [Arguments] ${locator} ${text} ${loglevel}=INFO Frame Should Contain ${locator} ${text} ${loglevel} List应该无选项 [Arguments] ${locator} List Should Have No Selections ${locator} List选项应该是 [Arguments] ${locator} @{items} List Selection Should Be ${locator} @{items} Radio按钮不应该被选择 [Arguments] ${group_name} Radio Button Should Not Be Selected ${group_name} Radio按钮应该被设置成 [Arguments] ${group_name} ${value} Radio Button Should Be Set To ${group_name} ${value} Url应该包含 [Arguments] ${expected} Location Should Contain ${expected} Xpath应该匹配X次 [Arguments] ${xpath} ${expected_xpath_count} ${msg}= ${loglevel}=INFO Xpath Should Match X Times ${xpath} ${expected_xpath_count} ${msg} ${loglevel} checkbox应该被选择 [Arguments] ${locator} checkbox should be selected ${locator} url应该是 [Arguments] ${url} Location Should Be ${url} 下次确认选择取消 Choose Cancel On Next Confirmation 下次确认选择确定 Choose Ok On Next Confirmation 从List中取消选项 [Arguments] ${locator} @{items} Unselect From List ${locator} @{items} 从List选择选项 [Arguments] ${locator} @{items} Select From List ${locator} @{items} 偏移拖拽 [Arguments] ${source} ${xoffset} ${yoffset} Drag And Drop By Offset ${source} ${xoffset} ${yoffset} 元素应该不包含文本 [Arguments] ${locator} ${expected} ${msg}= Element Should Not Contain ${locator} ${expected} ${msg} 元素应该不可用 [Arguments] ${locator} Element Should Be Disabled ${locator} 元素应该不可见 [Arguments] ${locator} ${msg}= Element Should Not Be Visible ${locator} ${msg} 元素应该包含文本 [Arguments] ${locator} ${text} Element Should Contain ${locator} ${text} 元素应该匹配x次 [Arguments] ${locator} ${count} ${msg}= ${loglevel}=INFO Locator Should Match X Times ${locator} ${count} ${msg} ${loglevel} 元素应该可用 [Arguments] ${locator} Element Should Be Enabled ${locator} 元素应该可见 [Arguments] ${locator} Element Should Be Visible ${locator} 元素文本应该是 [Arguments] ${locator} ${expected} ${msg}= Element Text Should Be ${locator} ${expected} ${msg} 全选List元素 [Arguments] ${locator} Select All From List ${locator}



    
    关闭所有浏览器
        Close All Browsers
    
    关闭浏览器
        Close Browser

    close browser 关闭当前的浏览器。close all browser 关键所有打开的浏览器和缓存重置
    Maximize Browser Window 关键字使当前打开的浏览器全屏。

    get windows size 关键字用于打设置打开浏览器的宽度和高度。以像素为单位,第一个参数 800 表示宽
    度,第二个参数 600 表示高度。


    关闭窗口 Close Window 切换浏览器 [Arguments] ${index} Switch Browser ${index} 创建Webdriver [Arguments] ${driver_name} ${alias}
    = ${kwargs}={} Create Webdriver ${driver_name} ${alias} ${kwargs} 删除Cookie [Arguments] ${name} Delete Cookie ${name} 删除所有Cookie Delete All Cookies 删除本地策略 [Arguments] ${strategy_name} Remove Location Strategy ${strategy_name} 刷新页面 Reload Page 双击元素 [Arguments] ${locator} Double Click Element ${locator} 取消选择Checkbox [Arguments] ${locator} Unselect Checkbox ${locator} 取消选择Frame Unselect Frame 回退 Go Back 在图片上按下鼠标左键 [Arguments] ${locator} Mouse Down On Image ${locator}
    重复多次操作
    repeat keyword ${num} ${operation}

    Open Browser   打开浏览器,参数包括url | browser=xx | alias=xx 等

    
    

    Click Link    点击一个超链接,参数是一个locator

    
    

    Click Element    点击一个元素,如单选框、复选框、按钮等

    
    

    Click Button    点击一个button,必须是button元素,应用场景少

    
    

    Input Text    输入文本,参数包括 Locator | Text

    
    

    Select Frame / Unselect Frame 选择进入 / 退出某个iframe,当页面中包含iframe是注意使用这个关键字,不然会定位不到元素

    
    

    Wait Until Page Contains  等待页面中出现某个文本后才进行下一步操作

    
    

    should be equal 是指两个对象相等,should match 是匹配模式,可用通配符

    
    

    Get Table Cell 可以更直接的获取表格的内容

    
    

    Get Element Attribute  获取某个元素的属性

    Evaluate是执行python表达式,并返回执行结果

    creat list 创建列表

    get time 获取当前时间

    screenshot 库

  • 相关阅读:
    建造者模式
    模板方法模式
    抽象工厂模式
    工厂方法模式
    Josephus环问题
    单例模式
    求两个数的最大公约数
    Nginx的安装与部署
    左京大夫显辅
    java 调用第三方系统时的连接代码-记录
  • 原文地址:https://www.cnblogs.com/Alysa-lrr/p/9449774.html
Copyright © 2011-2022 走看看