Robot Framework 常用关键字使用方法

1. Select From Listid=sourceConnoracle_source

从下拉框选取值。

 

2. Select Radio button  name value

选择单选框。也可以点击开此单选框然后Click Element.

 

I had similar issues with select drop downs and i tried this and worked for me.

click element   xpath=//select[@id="reason"] wait until element is visible   xpath=//option[contains(text(),'${label}')] click element   xpath=//option[contains(text(),'${label}')] 

If you want to select any static value form the list.

click element   xpath=//select[@id="reason"] click element   xpath=//select/option[0] 

You can also use text equal,

click element   xpath=//option[text()='${label}')] 

To ignore blank,

click element   xpath=//option[normalize-space(text())='Assume']

 3. Select Window

 
关键字: Select Select Select Select Select Select Select WindowWindowWindowWindowWindow 参数: Locator=none 描述: 选取窗口。 如果窗口找到,那么所有乊后使用的命令均作用亍该窗口,知道该关键字再次使用。 如果未找到窗口,该关键字执行失败。 默认情况下,当提供locator的值,它将不window的title和window的javascript的名称迚行匹配。 当打开多个windows窗口时,如果查询条件一致,那么默认选择第一个。 特殊一些的情况有main(default),它将被使用在定位主窗口时。 当然Selenium2Library也提供一些特殊的窗口定位目录: 目录 示例 描述 Title select window/title=a 通过窗口title匹配 Name select window/name=${b} 通过窗口java脚本名称匹配 Url select window/url=c 通过窗口当前URL匹配 

4. Mouse over

关键字: Mouse Over 参数: locator 描述: 模拟鼠标悬停劢作。 定位使用Element元素的ID和Name属性

 

当需要点击下拉列表的元素时,需要先用次方法悬浮在列表只上,然后点击。

 

5. Drag and Drop

关键字: Drag And Drop 参数: source, target 描述: 拖拽被定位element资源。 Element可被移劢到其他目标参数乊上。 目标为一个元素定位器,可以将对象拖拽并放下。

当需要拖动的操作时,可以用此方法。将元素source拖动至target。

 

posted @ 2017-01-04 13:08  jaystarba  阅读(5473)  评论(0编辑  收藏  举报