我想点击第二个链接
<ul id="library_list" class="side-menu" style="height: 358px;">
<li class="side-menu-section selected-section">
<a class="side-menu-section-link qa-group-id-undefined open" href="#">First Link</a>
</li>
<li class="side-menu-section">
<a class="side-menu-section-link qa-group-id-undefined" href="#">Second Link</a>
</li>
</ul>
我通过执行以下代码
得到了异常pageUrls.QuerySelector('side-menu-section a[text="SecondLink"]')).Click()
你能帮忙解决这个问题。
答案 0 :(得分:0)
我认为你的选择器不正确......
console.log(document.querySelector('.side-menu-section:last-child a'));
&#13;
<ul id="library_list" class="side-menu" style="height: 358px;">
<li class="side-menu-section selected-section">
<a class="side-menu-section-link qa-group-id-undefined open" href="#">First Link</a>
</li>
<li class="side-menu-section">
<a class="side-menu-section-link qa-group-id-undefined" href="#">Second Link</a>
</li>
</ul>
&#13;