title: Select the link which text contains "Agent detail" using XPath
body: <p>I have the following HTML code:</p>
  <pre><code>&lt;div class=&quot;menu&quot;&gt;
      &lt;ul class=&quot;operation&quot;&gt;
          &lt;li class=&quot;menu_icon   selected&quot; id=&quot;icon_oper-agents&quot;&gt;
              &lt;div id=&quot;title_menu&quot; style=&quot;color:#FFF; padding-top:12px; display:none;&quot;&gt;Monitoring&lt;/div&gt;
                  &lt;ul id=&quot;subicon_oper-agents&quot; class=&quot;submenu invisible&quot; style=&quot;display: none;&quot;&gt;
                      &lt;li id=&quot;Views&quot; class=&quot;has_submenu submenu_selected selected&quot;&gt;
                          &lt;div class=&quot; SubNoLink submenu_text submenu_text_middle&quot;&gt;Views&lt;/div&gt;
                          &lt;ul id=&quot;subViews&quot; class=&quot;submenu2&quot; style=&quot;display: none;&quot;&gt;
                             &lt;li class=&quot;sub_subMenu&quot; style=&quot;&quot;&gt;
                                &lt;a href=&quot;index.php?sec=view&amp;amp;sec2=operation/agentes/estado_agente&quot;&gt;
                                   &lt;div class=&quot;submenu_text submenu2_text_middle&quot; title=&quot;&quot;&gt;Agent detail&lt;/div&gt;
                                &lt;/a&gt;
                             &lt;/li&gt;
                             &lt;li class=&quot;sub_subMenu&quot; style=&quot;&quot;&gt;
                                &lt;a href=&quot;index.php?sec=view&amp;amp;sec2=extensions/realtime_graphs&quot;&gt;
                                   &lt;div class=&quot;submenu_text submenu2_text_last&quot; title=&quot;&quot;&gt;Real-time graphs&lt;/div&gt;
                                &lt;/a&gt;
                             &lt;/li&gt;
                          &lt;/ul&gt;
                      &lt;/li&gt;
                  &lt;/ul&gt;
              &lt;/div&gt;
          &lt;/li&gt;
      &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  <p>I need to get to the link &quot;index.php?sec=view&amp;sec2=operation/agentes/estado_agente&quot; (<strong>whose text is Agent detail</strong>), using XPATH.</p>
  <p>I already have this, but it is of no use:
  <code>'//*[@id=&quot;subViews&quot;]/li[4]/a'</code></p>
  <p>I need this Xpath expression to create a python function that uses the selenium Webdriver client to accept &quot;Agent detail&quot; as parameter, and return the Web Element that represents it.</p>
  <h3>The key part of the previous code is:</h3>
  <pre><code>&lt;li class=&quot;sub_subMenu&quot; style=&quot;&quot;&gt;
    &lt;a href=&quot;index.php?sec=view&amp;amp;sec2=operation/agentes/estado_agente&quot;&gt;
       &lt;div class=&quot;submenu_text submenu2_text_middle&quot; title=&quot;&quot;&gt;Agent detail&lt;/div&gt;
    &lt;/a&gt;
  &lt;/li&gt;
  </code></pre>