<bdo id='JwWJu'></bdo><ul id='JwWJu'></ul>
    <legend id='JwWJu'><style id='JwWJu'><dir id='JwWJu'><q id='JwWJu'></q></dir></style></legend>
    <tfoot id='JwWJu'></tfoot>

      <i id='JwWJu'><tr id='JwWJu'><dt id='JwWJu'><q id='JwWJu'><span id='JwWJu'><b id='JwWJu'><form id='JwWJu'><ins id='JwWJu'></ins><ul id='JwWJu'></ul><sub id='JwWJu'></sub></form><legend id='JwWJu'></legend><bdo id='JwWJu'><pre id='JwWJu'><center id='JwWJu'></center></pre></bdo></b><th id='JwWJu'></th></span></q></dt></tr></i><div id='JwWJu'><tfoot id='JwWJu'></tfoot><dl id='JwWJu'><fieldset id='JwWJu'></fieldset></dl></div>

      <small id='JwWJu'></small><noframes id='JwWJu'>

      使用量角器在列表中选择第二个锚元素

      时间:2023-10-12
    1. <small id='uUP6p'></small><noframes id='uUP6p'>

          <bdo id='uUP6p'></bdo><ul id='uUP6p'></ul>
            <tbody id='uUP6p'></tbody>
        • <tfoot id='uUP6p'></tfoot>

            • <legend id='uUP6p'><style id='uUP6p'><dir id='uUP6p'><q id='uUP6p'></q></dir></style></legend>
              <i id='uUP6p'><tr id='uUP6p'><dt id='uUP6p'><q id='uUP6p'><span id='uUP6p'><b id='uUP6p'><form id='uUP6p'><ins id='uUP6p'></ins><ul id='uUP6p'></ul><sub id='uUP6p'></sub></form><legend id='uUP6p'></legend><bdo id='uUP6p'><pre id='uUP6p'><center id='uUP6p'></center></pre></bdo></b><th id='uUP6p'></th></span></q></dt></tr></i><div id='uUP6p'><tfoot id='uUP6p'></tfoot><dl id='uUP6p'><fieldset id='uUP6p'></fieldset></dl></div>
                本文介绍了使用量角器在列表中选择第二个锚元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我有一个锚标记列表,并且必须测试单击列表中的第二个标记.

                I have a list of anchor tags and have to test clicking the 2nd tag in the list.

                <ul id="shortcuts">
                    <li><a ui-sref="app.journeyExplorer" href="#/journey-explorer/"><span class="ng-binding">1</span></a></li>
                    <li><a ui-sref="app.userGroupManager" href="#/user-group-manager"><span class="ng-binding">2</span></a></li>
                </ul>
                

                经过大量调查和测试得出的结论是正确的说法应该是:

                After much investigation and testing reached at the conclusion that the correct statement should be:

                element(By.id('shortcuts')).element(By.tagName('a')).get(1).click();
                

                但它显示未定义.如果我使用 get() 它不起作用.没有得到它单击列表中的第一个锚标记并发出警告:找到多个锚标记,在这种情况下选择第一个锚标记"

                But it shows undefined. If I use get() it doesn't work. without get it clicks the 1st anchor tag in the list with a warning: 'More than one anchor tag found, in such case the 1st one is selected'

                有人可以帮忙吗?谢谢.

                Can someone please help out with this ? Thanks.

                推荐答案

                你可能想试试下面的选择器(注意 all() 而不是第二个 element()匹配所有锚点(以便接下来出现的 .get() 有意义.

                You might want to try selector below (note all() instead of second element() to match all anchors (so that .get() that comes next makes any sense.

                element(By.id('shortcuts')).all(By.tagName('a')).get(1).click();
                

                或通过 .css

                element(By.css('#shortcuts a:nth-child(1)').click();
                

                这篇关于使用量角器在列表中选择第二个锚元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:使用量角器在 Firefox 上下载文件 下一篇:使用 each() 方法时的量角器过时元素引用

                相关文章

                最新文章

                <tfoot id='WvVYr'></tfoot>

                <small id='WvVYr'></small><noframes id='WvVYr'>

                  <i id='WvVYr'><tr id='WvVYr'><dt id='WvVYr'><q id='WvVYr'><span id='WvVYr'><b id='WvVYr'><form id='WvVYr'><ins id='WvVYr'></ins><ul id='WvVYr'></ul><sub id='WvVYr'></sub></form><legend id='WvVYr'></legend><bdo id='WvVYr'><pre id='WvVYr'><center id='WvVYr'></center></pre></bdo></b><th id='WvVYr'></th></span></q></dt></tr></i><div id='WvVYr'><tfoot id='WvVYr'></tfoot><dl id='WvVYr'><fieldset id='WvVYr'></fieldset></dl></div>
                  • <bdo id='WvVYr'></bdo><ul id='WvVYr'></ul>

                1. <legend id='WvVYr'><style id='WvVYr'><dir id='WvVYr'><q id='WvVYr'></q></dir></style></legend>