使用robot frame selenium中遇到的问题汇总

1、问题:robot运行时提示:[ WARN ] Keyword 'Capture Page Screenshot' could not be run on failure: No browser is open"

    现象:运行时打开浏览器后再浏览器的导航栏中无法数据url

解决方法:浏览器版本太高,降低浏览器版本

2、统计li(入下图)个数

<ul class="jqtree_common jqtree-tree" role="tree">
<li class="jqtree_common" role="presentation" aria-selected="false">
<li class="jqtree_common" role="presentation">
<li class="jqtree_common" role="presentation">
<li class="jqtree_common" role="presentation">
<li class="jqtree_common" role="presentation">

可用方法:

document.getElementsByTagName("li").length;

document.getElementsByClassName("jqtree_common").length;

ClassName:在统计时会把jqtree_common jqtree-tree也统计出,会导致统计时有问题,可根据项目特点进行减法,或根据项目进入判断,我目前去统计这个是去找相应的数据,可以根据找到的数据去判断,可判断下如果数据为空则进行一些处理

3、关于跳出整个循环和跳出当前循环的使用

continue for loop:跳出当前循环

Exit For Loop:跳出整个循环

 

*** Test Cases ***
test
:FOR ${i} in range 1 5
\ run keyword if ${i}==3 continue for loop #Exit For Loop
\ log ${i}

4、定义list @{i},使用时${i}

posted @ 2016-09-09 14:16  萱娃  阅读(8359)  评论(3编辑  收藏  举报