一、窗口关键字使用
1、当前浏览器弹出新的窗口
使用Select Window和Close Window处理弹出窗口。实际使用中Select Window不一定会一次选中,通常会结合Wait Until Keyword Succeeds一起使用。关闭主窗口时要先选择Select Window Main才可以进行操作。
注:在Select Window时,会遇到模态窗口,这种窗口不一定能直接选择到,可以通过handle操作窗口的关键字,select window by handle(通过handle选择window);get window handles(获取当前线程所有窗口的handles,返回List);get current window handle(获取当前窗口的handle)
2、重新打开一个新的浏览器
Open Browser打开2个浏览器,用Switch Browser来进行切换,参数是打开浏览器indes顺序或alias别名,关闭所有浏览器用Close All Browsers。
3、Frame
select frame 和 unselect frame,若遇到元素在页面中但找不到,就要看看是不是在frame或iframe里,先select frame选择操作,再回到frame外操作费其他元素,就要unselect frame出去。(注:进去的时候要一层层的进入,出来的时候直接就出来了,若要再对第二层或第一层进行操作就要重新进入)
二、Element
1、press key模拟键盘操作,“press key\\13”模拟回车。
2、Assign id to element 若一个对象没有id,可以给它指定一个id
3、AutoItLibrary鼠标操作mouse down,mouse up,mouse over,mouse out
4、Get horizontal position、get vertical position用来获取当前对象的左上角顶点距离整个页面的横坐标和纵坐标。
5、获取页面元素,get value、get text,若要获取元素的其他属性值则用get element attribute关键字,如class值,get element attribute element_id@class来获取
三、formelement
checkbox(select checkbox和unselect checkbox复选框的勾选),radio buttons(select radio button关键字),text fields(choose file(用于上传文件的时候选择文件)、input text、input password(日志上不会把密码打印出来)),button.form直接有关的关键字就一个submit form用于提交表单的
四、SelectElement
列表框:单选、多选,选择列表框中的某一项,需要使用select from list,select from list by index、select from list by value、select from list by label。多选框全部选择可以用select all from list。若想知道列表框里都有什么列表项,可以用get list items来获取所有列表项。
五、tableElement
get table cell,click element at table cell、click link at table cell用于点击表格指定单元格里的元素和链接。get index in table column和get index in table row用来获取某个文本在表格的哪一行哪一列。
六、JavaScript
execute JavaScript和execute async JavaScript(异步执行,在函数最后加上回调来返回结果,若超时时间内没有执行完成则会失败)用于执行JavaScript脚本。
confirm action自动进行对话框的确认,若要点击取消,则先用choose cancel on next confirmation进行设置,再用confirm action。恢复点同意,同样先要choose ok on next confirmation。
七、screenshot
只有一个关键字capture page screenshot,对当前页面进行截图(截图是基于当前浏览器的页面进行的,若此时页面被关闭了,就无法使用了,可用RF自带的截图库里的方法进行截图)。
八、waiting
wait for condition、wait until page contains、wait until page contains element,一般用BuiltIn里的关键字Wait Until Keyword Succeeds较多。
原文:https://www.cnblogs.com/selinaniur/p/9598442.html