0

下面提到了菜单和子菜单的 HTML 源代码,我想点击子菜单。如何使用 selenium Webdriver 做到这一点。

下面是页面的 HTML 信息。

 <div id="topnav" class="row" role="navigation">
     <div id="nav" class="row-980">
      <div class="region region-nav">

//顶部导航菜单栏

     <div id="block-menu-block--navigation-top" class="block block-menu-block">
   <div class="content">
      <ul class="muchomenu-menu muchomenu-menu-horizontal">
        <li class="first leaf has-children active-trail active menu-mlid-838 muchomenu-parent on">
      <span class="muchomenu-parent-title">
   <div class="muchomenu-bin muchomenu-slots" style="left: 0px; right: auto; top: -9999px;">
      </li>
     <li class="leaf has-children menu-mlid-859 muchomenu-parent off">
      <span class="muchomenu-parent-title">
        <div class="muchomenu-bin muchomenu-slots" style="left: 111px; right: auto;  top: -9999px;">
         <div class="col-2">
           <div class="col left margin_0_20_0_0">
           <div class="panel-pane pane-menu-tree pane-main-menu">
   <ul>

//菜单中的第一个菜单项

   <li class="pane-title">
      <a alignment="left" panel="our_businesses" href="/our-businesses/ukpil-          overview">UKPIL</a>
     </li>
    <li class="first leaf menu-mlid-1195">
    <li class="leaf has-children menu-mlid-1250">
    <li class="last leaf has-children menu-mlid-976">
     </ul>
      </div>
       </div>
    <div class="col left margin_0_20_0_0">
    <div class="clear"></div>
      </div>
     </div>
      </li>
       <li class="leaf has-children menu-mlid-835 muchomenu-parent special-center off">
        <span class="muchomenu-parent-title">
      <div class="muchomenu-bin muchomenu-slots" style="left: 0px; right: auto; top:  -9999px;">
       <div class="col-3">
           <div class="col left margin_0_20_0_0">
        <div class="panel-pane pane-menu-tree pane-main-menu">
        <ul>
        <li class="pane-title">
              <a href="/our-customers/customer-commitment">Customer commitment</a>
             </li>
             <li class="first leaf menu-mlid-982">
             <li class="last leaf menu-mlid-983">
            </ul>
                </div>
            <div class="panel-separator"></div>
                     <div class="panel-pane pane-menu-tree pane-main-menu">
              </div>
              <div class="col left margin_0_20_0_0">
              <div class="col left margin_0_20_0_0">
              <div class="clear"></div>
             </div>
              </div>
                </li>
          <li class="leaf has-children menu-mlid-853 muchomenu-parent special-center off">
         <li class="leaf has-children menu-mlid-860 muchomenu-parent special-center off">
         <li class="leaf has-children menu-mlid-858 muchomenu-parent special off">
         <li class="last leaf has-children menu-mlid-857 muchomenu-parent special off">
       </ul>
          </div>
    </div>
     </div>
4

0 回答 0