标签:
1、 如果是一个列表页面,当要触发编辑页面是如何做的呢?其实我测试只要点击第一条数据去编辑就好啦!如果页面结构如下
<li class="myatc-li"> <h3><span class="atc-status">(待审核) </span><a class="atc-head" href="/article/detail/199.html">lsg_1463025947759</a> </h3> <p class="atc-content">132131231</p> <a class="see-all" href="/article/detail/199.html">...查看全文 ></a> <p class="atc-detail clearfix"> <a>阅读<span>0</span></a> <a>点赞<span>0</span></a> <span>2016-05-12 12:05:51</span> </p> <p class="atc-editor"> <a href="/user/article/edit?id=199"><span class="iconfont"> </span>编辑</a> <a href="javascript:;" class="article_del" data-id="199"><span class="iconfont"> </span>删除</a> </p> </li> <li class="myatc-li"> <h3><span class="atc-status">(待审核) </span><a class="atc-head" href="/article/detail/197.html">lsg_1463022192555</a> </h3> <p class="atc-content">132131231</p> <a class="see-all" href="/article/detail/197.html">...查看全文 ></a> <p class="atc-detail clearfix"> <a>阅读<span>0</span></a> <a>点赞<span>0</span></a> <span>2016-05-12 11:03:16</span> </p> <p class="atc-editor"> <a href="/user/article/edit?id=197"><span class="iconfont"> </span>编辑</a> <a href="javascript:;" class="article_del" data-id="197"><span class="iconfont"> </span>删除</a> </p> </li>
我可以这样写,这里我们用到了elementByPartialLinkText ,elementByLinkText是全文字匹配的,很显然这里不适用,直接上代码
it(‘#3 write article edit‘, function() { return driver .elementByPartialLinkText(‘编辑‘) .click() .sleep(3000) })
[自动化平台系列] - 初次使用 Macaca-前端自动化测试(3)
标签:
原文地址:http://www.cnblogs.com/shenggen/p/5486603.html