RF框架我用的比较多,限于自己的代码水平,目前工作中一直是用RF框架。unittest框架,我也练习了很久,还差一点封装的技巧与设计模式的学习。所以不敢在项目中实践。
等明年我的代码水平再上升一个台阶后,就会慢慢使用单元测试框架了。这有一个时间过程的,目前精力放在接口自动化与代码练习这一块的学习中。
RF框架我用了大概一年的时间了,在做自动化测试的过程中,我基本上都是在使用jquery方法来定位元素的。
原因是第一,定位快,第二,功能强大,可以通过id,name,class,父亲找儿子,哥哥找弟弟,相邻元素之间都可以找到。配合JS几乎无往而不胜。(工作中只碰到过2次需要DOM来定位,其它的时候都能定位出来)
第三,调试方便,直接在开发者工具中的控制台调试。
上菜。
id: jquery=#id
name: jquery=[name='***']
class: jquery=div.btn
大家有没有发现这上面的三种格式是不是与CSS的一样。
没错。
找后代:jquery=div.btn>input>span
找相邻兄弟:jquery=div.btn+input.btn
找不相邻兄弟:jquery=div.btn input.btn
另外在实际工作中,这些方法有时要加上索引的。下标第几个。jquery索引是从0开始的,0是第一个。