Selenium webdriver - 带有span属性的选项卡的xPATH

时间:2016-04-12 11:27:55

标签: selenium xpath

我是Selenium的初学者。 我正在自动化内部门户,并需要将鼠标悬停在选项卡上,以显示下拉列表,然后单击此下拉列表中的项目。 我正在使用的代码如下:

<li class="adPresent">
   <a class="menuCog" href="#">
      <span>Billing </span>
   </a>
   <div class="bmgCL_subMenu bmgCL_subMenuMega" data-tracklinktext="Billing" data-linkcontainer="lt_section">
      <div class="bmgCL_subMenu_container">
          <div class="bmgCL_subMenu_content">
             <div class="col" width="80%">
                <div class="col servicesColCnt">
                   <!-- Test nav_child2.getRegularURL() https://controlcenter-itv2.centurylink.com/web/controlcenter/billing/invoices /web/controlcenter /billing/invoices -->
                   <!-- Test nav_child2.getRegularURL() https://controlcenter-itv2.centurylink.com/web/controlcenter/billing/analytics /web/controlcenter /billing/analytics -->
                   <!-- Test nav_child2.getRegularURL() https://controlcenter-itv2.centurylink.com/web/controlcenter/billing/addaccounts /web/controlcenter /billing/addaccounts -->
                   <!-- Test nav_child2.getRegularURL() https://controlcenter-itv2.centurylink.com/web/controlcenter/billing/reports /web/controlcenter /billing/reports -->
                   <!-- Test nav_child2.getRegularURL() https://controlcenter-itv2.centurylink.com/web/controlcenter/billing/calldetails /web/controlcenter /billing/calldetails -->
                </div>
            <div class="col">
               <!-- Test nav_child2.getRegularURL() https://controlcenter-itv2.centurylink.com/web/controlcenter/billing/invoices /web/controlcenter /billing/invoices -->
               <!--level2 2 Invoices -->
               <dl class="eachBlock" data-tracklinktext="Invoices" data-linkcontainer="lt_subsection">
                   <!-- 16 == 8 && 2 && [[3, 4, 1, 4, 6, 3, 3, 2], [2], [6, 3, 1, 2], [2, 2, 2], [3], [1, 5], [1], [1, 1, 2, 1, 1, 1, 1, 1], [0]] 2 -->
                   <dt>Invoices</dt>
                   <dd>
                       <a class="menuCog" href="/business/controlcenter/billing/invoices/view-bill" data-tracklinktext="View Bill">View Bill</a>
                   </dd>
                   <dd>
                        <a class="menuCog" href="/business/controlcenter/billing/invoices/paybill" data-tracklinktext="Pay Bill">Pay Bill</a>
                   </dd>
                   <dd>
                        <a class="menuCog" href="/business/controlcenter/billing/invoices/bill_pdf_data_dl" data-tracklinktext="Bill PDFs/Data Downloads">Bill PDFs/Data Downloads</a>
                   </dd>
                   <dd>
                        <a class="menuCog" href="/business/controlcenter/billing/invoices/delivery-options" data-tracklinktext="Delivery Options">Delivery Options</a>
                   </dd>
                   <dd>
                   <dd>
                   <!-- chunkHeight 11 breakBuffer 10 2 prevChunk 7 nextChunk 3 -->
                 </dl>
                </div>
            <div class="col">
          </div>
       <div class="bmgCL_clear"/>
    </div>
 </div>
 </div>
 </li>

HTML代码如下:

{{1}}

我希望找到“结算”标签的xpath,然后点击上面代码中的“查看帐单”链接。 你能帮我学习并识别上面嵌套的webelements的xpath。

0 个答案:

没有答案