title: Selenium nested li div menu select() or click() python
body: <h1>topMenuItem4 &gt; ul:nth-child(2) &gt; li:nth-child(6) &gt; a:nth-child(1) &gt; span:nth-child(1)</h1>
  <p>I have tried a variety of methods to accomplish this but I so far have not been able to select or click the provisioning server link.</p>
  <p>Tried this:
  browser.find_element_by_css_selector('#topMenuItem4 &gt; ul:nth-child(2) &gt; li:nth-child(6) &gt; a:nth-child(1) &gt; span:nth-child(1)').click()</p>
  <p>and this:</p>
  <p>browser.find_elements_by_xpath(&quot;//div[contains(@class,'menu-item') and (contains(.,'topMenuItem4'))]//div[contains(@class,'Provisioning Server')]&quot;)</p>
  <p>Here is a capture of the drop down menu</p>
  <p><a href="http://screencast.com/t/81EQFAO7c" rel="nofollow noreferrer">http://screencast.com/t/81EQFAO7c</a></p>
  <p>Here is the source:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; standalone=&quot;no&quot;?&gt;
  &lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
  &lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;en&quot; lang=&quot;en&quot;&gt;
    &lt;head&gt;
      &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot;/&gt;
      &lt;title&gt;Polycom - SoundPoint IP 450 Configuration Utility&lt;/title&gt;
      &lt;link rel=&quot;stylesheet&quot; href=&quot;css/main_page.css&quot; type=&quot;text/css&quot;/&gt;
      &lt;link rel=&quot;stylesheet&quot; href=&quot;css/page_content.css&quot; type=&quot;text/css&quot;/&gt;
      &lt;script type=&quot;text/javascript&quot; src=&quot;js/jquery.js&quot;&gt;&lt;/script&gt;
      &lt;script type=&quot;text/javascript&quot; src=&quot;js/util.js&quot;&gt;&lt;/script&gt;
      &lt;script type=&quot;text/javascript&quot; src=&quot;js/main_page.js&quot;&gt;&lt;/script&gt;
      &lt;script type=&quot;text/javascript&quot; src=&quot;js/page_content.js&quot;&gt;&lt;/script&gt;
      &lt;script type=&quot;text/javascript&quot; src=&quot;js/configurator.js&quot;&gt;&lt;/script&gt;
      &lt;meta http-equiv=&quot;Cache-Control&quot; content=&quot;no-cache&quot;/&gt;
      &lt;meta http-equiv=&quot;Pragma&quot; content=&quot;no-cache&quot;/&gt;
      &lt;meta http-equiv=&quot;Expires&quot; content=&quot;0&quot;/&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;div id=&quot;header&quot;&gt;
        &lt;div id=&quot;logohdr&quot;&gt;
          &lt;img src=&quot;images/logo.png&quot;/&gt;
          &lt;span class=&quot;leftBordered&quot;&gt;
            SoundPoint IP 450
          &lt;/span&gt;
        &lt;/div&gt;
        &lt;div id=&quot;langHeader&quot;&gt;
          &lt;span textId=&quot;122&quot;&gt; &lt;/span&gt;
          &lt;select id=&quot;langaugeId&quot;&gt;
            &lt;option value=&quot;en-in&quot;&gt;English Internal (en-in)&lt;/option&gt;
            &lt;option value=&quot;zh-cn&quot;&gt;简体中文 (zh-cn)&lt;/option&gt;
            &lt;option value=&quot;da-dk&quot;&gt;Dansk (da-dk)&lt;/option&gt;
            &lt;option value=&quot;nl-nl&quot;&gt;Nederlands (nl-nl)&lt;/option&gt;
            &lt;option value=&quot;en-us&quot;&gt;English (en-us)&lt;/option&gt;
            &lt;option value=&quot;fr-fr&quot;&gt;Français (fr-fr)&lt;/option&gt;
            &lt;option value=&quot;de-de&quot;&gt;Deutsch (de-de)&lt;/option&gt;
            &lt;option value=&quot;it-it&quot;&gt;Italiano (it-it)&lt;/option&gt;
            &lt;option value=&quot;ja-jp&quot;&gt;日本語 (ja-jp)&lt;/option&gt;
            &lt;option value=&quot;ko-kr&quot;&gt;한국어 (ko-kr)&lt;/option&gt;
            &lt;option value=&quot;no-no&quot;&gt;Norsk (no-no)&lt;/option&gt;
            &lt;option value=&quot;pl-pl&quot;&gt;Polski (pl-pl)&lt;/option&gt;
            &lt;option value=&quot;pt-br&quot;&gt;Português (pt-br)&lt;/option&gt;
            &lt;option value=&quot;ru-ru&quot;&gt;Русский (ru-ru)&lt;/option&gt;
            &lt;option value=&quot;sl-si&quot;&gt;Slovenski (sl-si)&lt;/option&gt;
            &lt;option value=&quot;es-es&quot;&gt;Español (es-es)&lt;/option&gt;
            &lt;option value=&quot;sv-se&quot;&gt;Svenska (sv-se)&lt;/option&gt;
            &lt;option value=&quot;zh-cht&quot;&gt;繁體中文 (zh-cht)&lt;/option&gt;
          &lt;/select&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;div id=&quot;navigation&quot;&gt;
        &lt;ul id=&quot;utility-nav&quot;&gt;
          &lt;li&gt;
            &lt;a href=&quot;javascript:;&quot; class=&quot;rightBordered&quot;&gt;
              &lt;span textId=&quot;677&quot;&gt; &lt;/span&gt;
              Admin
            &lt;/a&gt;
          &lt;/li&gt;
          &lt;li src=&quot;logout&quot;&gt;
            &lt;a href=&quot;login.htm&quot;&gt;
              &lt;span textId=&quot;678&quot;&gt; &lt;/span&gt;
            &lt;/a&gt;
          &lt;/li&gt;
        &lt;/ul&gt;
        &lt;ul id=&quot;primary-nav&quot;&gt;
          &lt;li src=&quot;home.htm&quot; id=&quot;topMenuItem1&quot;&gt;
            &lt;a href=&quot;javascript:;&quot;&gt;
              &lt;span textId=&quot;96&quot;&gt; &lt;/span&gt;
            &lt;/a&gt;
          &lt;/li&gt;
          &lt;li src=&quot;simpleSetup.htm&quot; id=&quot;topMenuItem2&quot;&gt;
            &lt;a href=&quot;javascript:;&quot;&gt;
              &lt;span textId=&quot;201&quot;&gt; &lt;/span&gt;
            &lt;/a&gt;
          &lt;/li&gt;
          &lt;li class=&quot;menu-item&quot; id=&quot;topMenuItem3&quot;&gt;
            &lt;a href=&quot;javascript:;&quot;&gt;
              &lt;span textId=&quot;190&quot;&gt; &lt;/span&gt;
            &lt;/a&gt;
            &lt;ul&gt;
              &lt;li src=&quot;datetimeConf.htm&quot;&gt;
                &lt;a href=&quot;javascript:;&quot;&gt;
                  &lt;span textId=&quot;57&quot;&gt; &lt;/span&gt;
                &lt;/a&gt;
              &lt;/li&gt;
              &lt;li src=&quot;sampConf.htm&quot;&gt;
                &lt;a href=&quot;javascript:;&quot;&gt;
                  &lt;span textId=&quot;218&quot;&gt; &lt;/span&gt;
                &lt;/a&gt;
              &lt;/li&gt;
              &lt;li src=&quot;bgConfMedGray.htm&quot;&gt;
                &lt;a href=&quot;javascript:;&quot;&gt;
                  &lt;span textId=&quot;24&quot;&gt; &lt;/span&gt;
                &lt;/a&gt;
              &lt;/li&gt;
              &lt;li src=&quot;presence.htm&quot;&gt;
                &lt;a href=&quot;javascript:;&quot;&gt;
                  &lt;span textId=&quot;534&quot;&gt; &lt;/span&gt;
                &lt;/a&gt;
              &lt;/li&gt;
              &lt;li src=&quot;othersConf.htm&quot;&gt;
                &lt;a href=&quot;javascript:;&quot;&gt;
                  &lt;span textId=&quot;171&quot;&gt; &lt;/span&gt;
                &lt;/a&gt;
              &lt;/li&gt;
            &lt;/ul&gt;
          &lt;/li&gt;
          &lt;li class=&quot;menu-item&quot; id=&quot;topMenuItem4&quot;&gt;
            &lt;a href=&quot;javascript:;&quot;&gt;
              &lt;span textId=&quot;242&quot;&gt; &lt;/span&gt;
            &lt;/a&gt;
            &lt;ul&gt;
              &lt;li src=&quot;browConf.htm&quot; checkFeature=&quot;MB&quot;&gt;
                &lt;a href=&quot;javascript:;&quot;&gt;
                  &lt;span textId=&quot;146&quot;&gt; &lt;/span&gt;
                &lt;/a&gt;
              &lt;/li&gt;
              &lt;li src=&quot;logConf.htm&quot;&gt;
                &lt;a href=&quot;javascript:;&quot;&gt;
                  &lt;span textId=&quot;135&quot;&gt; &lt;/span&gt;
                &lt;/a&gt;
              &lt;/li&gt;
              &lt;li src=&quot;applConf.htm&quot;&gt;
                &lt;a href=&quot;javascript:;&quot;&gt;
                  &lt;span textId=&quot;8&quot;&gt; &lt;/span&gt;
                &lt;/a&gt;
              &lt;/li&gt;
              &lt;li src=&quot;codecprefConf.htm&quot;&gt;
                &lt;a href=&quot;javascript:;&quot;&gt;
                  &lt;span textId=&quot;12&quot;&gt; &lt;/span&gt;
                &lt;/a&gt;
              &lt;/li&gt;
              &lt;li src=&quot;audioCodecProfConf.htm&quot;&gt;
                &lt;a href=&quot;javascript:;&quot;&gt;&lt;span textId=&quot;9&quot;&gt; &lt;/span&gt; Codec Profiles&lt;/a&gt;
              &lt;/li&gt;
              &lt;li src=&quot;provConf.htm&quot;&gt;
                &lt;a href=&quot;javascript:;&quot;&gt;
                  &lt;span textId=&quot;316&quot;&gt; &lt;/span&gt;
                &lt;/a&gt;
              &lt;/li&gt;
              &lt;li src=&quot;syslogConf.htm&quot;&gt;
                &lt;a href=&quot;javascript:;&quot;&gt;
                  &lt;span textId=&quot;533&quot;&gt; &lt;/span&gt;
                &lt;/a&gt;
              &lt;/li&gt;
              &lt;li class=&quot;menu-item-2&quot;&gt;
                &lt;a href=&quot;javascript:;&quot;&gt;
                  &lt;span textId=&quot;152&quot;&gt; &lt;/span&gt;
                &lt;/a&gt;
                &lt;ul&gt;
                  &lt;li src=&quot;qosConf.htm&quot;&gt;
                    &lt;a href=&quot;javascript:;&quot;&gt;
                      &lt;span textId=&quot;197&quot;&gt; &lt;/span&gt;
                    &lt;/a&gt;
                  &lt;/li&gt;
                  &lt;li src=&quot;rtpConf.htm&quot;&gt;
                    &lt;a href=&quot;javascript:;&quot;&gt;
                      &lt;span textId=&quot;204&quot;&gt; &lt;/span&gt;
                    &lt;/a&gt;
                  &lt;/li&gt;
                  &lt;li src=&quot;natConf.htm&quot;&gt;
                    &lt;a href=&quot;javascript:;&quot;&gt;
                      &lt;span textId=&quot;150&quot;&gt; &lt;/span&gt;
                    &lt;/a&gt;
                  &lt;/li&gt;
                  &lt;li src=&quot;tcpConf.htm&quot;&gt;
                    &lt;a href=&quot;javascript:;&quot;&gt;
                      &lt;span textId=&quot;253&quot;&gt; &lt;/span&gt;
                    &lt;/a&gt;
                  &lt;/li&gt;
                  &lt;li src=&quot;sslSecurityConf.htm&quot;&gt;
                    &lt;a href=&quot;javascript:;&quot;&gt;
                      &lt;span textId=&quot;228&quot;&gt; &lt;/span&gt;
                    &lt;/a&gt;
                  &lt;/li&gt;
                  &lt;li src=&quot;ethernetConf.htm&quot;&gt;
                    &lt;a href=&quot;javascript:;&quot;&gt;
                      &lt;span textId=&quot;329&quot;&gt; &lt;/span&gt;
                    &lt;/a&gt;
                  &lt;/li&gt;
                &lt;/ul&gt;
              &lt;/li&gt;
              &lt;li src=&quot;pttConf.htm&quot;&gt;
                &lt;a href=&quot;javascript:;&quot;&gt;
                  &lt;span textId=&quot;473&quot;&gt; &lt;/span&gt;
                &lt;/a&gt;
              &lt;/li&gt;
              &lt;li src=&quot;sipConf.htm&quot;&gt;
                &lt;a href=&quot;javascript:;&quot;&gt;
                  &lt;span textId=&quot;531&quot;&gt; &lt;/span&gt;
                &lt;/a&gt;
              &lt;/li&gt;
              &lt;li class=&quot;menu-item-3&quot; src=&quot;reg_1.htm&quot; displaySubMenuInLeftPanel=&quot;1&quot;&gt;
                &lt;a href=&quot;javascript:;&quot;&gt;
                  &lt;span textId=&quot;125&quot;&gt; &lt;/span&gt;
                &lt;/a&gt;
                &lt;ul&gt;
                  &lt;li src=&quot;reg_1.htm&quot;&gt;
                    &lt;a href=&quot;javascript:;&quot;&gt;&lt;span textId=&quot;123&quot;&gt; &lt;/span&gt; 1&lt;/a&gt;
                  &lt;/li&gt;
                  &lt;li src=&quot;reg_2.htm&quot;&gt;
                    &lt;a href=&quot;javascript:;&quot;&gt;&lt;span textId=&quot;123&quot;&gt; &lt;/span&gt; 2&lt;/a&gt;
                  &lt;/li&gt;
                  &lt;li src=&quot;reg_3.htm&quot;&gt;
                    &lt;a href=&quot;javascript:;&quot;&gt;&lt;span textId=&quot;123&quot;&gt; &lt;/span&gt; 3&lt;/a&gt;
                  &lt;/li&gt;
                &lt;/ul&gt;
              &lt;/li&gt;
              &lt;li src=&quot;userAccountConf.htm&quot;&gt;
                &lt;a href=&quot;javascript:;&quot;&gt;
                  &lt;span textId=&quot;271&quot;&gt; &lt;/span&gt;
                &lt;/a&gt;
              &lt;/li&gt;
              &lt;li src=&quot;phoneLockConf.htm&quot;&gt;
                &lt;a href=&quot;javascript:;&quot;&gt;
                  &lt;span textId=&quot;178&quot;&gt; &lt;/span&gt;
                &lt;/a&gt;
              &lt;/li&gt;
            &lt;/ul&gt;
          &lt;/li&gt;
          &lt;li class=&quot;menu-item&quot; id=&quot;topMenuItem5&quot;&gt;
            &lt;a href=&quot;javascript:;&quot;&gt;
              &lt;span textId=&quot;62&quot;&gt; &lt;/span&gt;
            &lt;/a&gt;
            &lt;ul&gt;
              &lt;li src=&quot;viewlogs.htm&quot;&gt;
                &lt;a href=&quot;javascript:;&quot;&gt;
                  &lt;span textId=&quot;283&quot;&gt; &lt;/span&gt;
                &lt;/a&gt;
              &lt;/li&gt;
            &lt;/ul&gt;
          &lt;/li&gt;
          &lt;li class=&quot;menu-item&quot; id=&quot;topMenuItem6&quot;&gt;
            &lt;a href=&quot;javascript:;&quot;&gt;
              &lt;span textId=&quot;276&quot;&gt; &lt;/span&gt;
            &lt;/a&gt;
            &lt;ul&gt;
              &lt;li src=&quot;importexportconf.htm&quot;&gt;
                &lt;a href=&quot;javascript:;&quot;&gt;
                  &lt;span textId=&quot;111&quot;&gt; &lt;/span&gt;
                &lt;/a&gt;
              &lt;/li&gt;
              &lt;li src=&quot;phoneBackupRestore.htm&quot;&gt;
                &lt;a href=&quot;javascript:;&quot;&gt;
                  &lt;span textId=&quot;177&quot;&gt; &lt;/span&gt;
                &lt;/a&gt;
              &lt;/li&gt;
              &lt;li src=&quot;upgrade.htm&quot;&gt;
                &lt;a href=&quot;javascript:;&quot;&gt;
                  &lt;span textId=&quot;246&quot;&gt; &lt;/span&gt;
                &lt;/a&gt;
              &lt;/li&gt;
              &lt;li src=&quot;Soft_Key_configTool.htm&quot;&gt;
                &lt;a href=&quot;javascript:;&quot;&gt;
                  &lt;span textId=&quot;285&quot;&gt; &lt;/span&gt;
                &lt;/a&gt;
              &lt;/li&gt;
              &lt;li src=&quot;Line_Key_configTool.htm&quot;&gt;
                &lt;a href=&quot;javascript:;&quot;&gt;
                  &lt;span textId=&quot;536&quot;&gt; &lt;/span&gt;
                &lt;/a&gt;
              &lt;/li&gt;
              &lt;li src=&quot;restartPhone.htm&quot;&gt;
                &lt;a href=&quot;javascript:;&quot;&gt;
                  &lt;span textId=&quot;214&quot;&gt; &lt;/span&gt;
                &lt;/a&gt;
              &lt;/li&gt;
              &lt;li src=&quot;rebootPhone.htm&quot;&gt;
                &lt;a href=&quot;javascript:;&quot;&gt;
                  &lt;span textId=&quot;209&quot;&gt; &lt;/span&gt;
                &lt;/a&gt;
              &lt;/li&gt;
            &lt;/ul&gt;
          &lt;/li&gt;
        &lt;/ul&gt;
      &lt;/div&gt;
      &lt;div id=&quot;breadcrumbs&quot;&gt;
        &lt;p/&gt;
      &lt;/div&gt;
      &lt;div id=&quot;wrapper&quot;&gt;
        &lt;div id=&quot;nav&quot; class=&quot;nav&quot;&gt;
          &lt;div id=&quot;phoneimage&quot;&gt;
            &lt;p/&gt;
          &lt;/div&gt;
          &lt;ul&gt;
            &lt;li&gt;
              &lt;div&gt;
                &lt;span textId=&quot;673&quot;&gt; &lt;/span&gt;
              &lt;/div&gt;
              &lt;ul/&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;/div&gt;
        &lt;div id=&quot;content&quot; class=&quot;content&quot;&gt;
          &lt;div id=&quot;pageContent&quot;&gt;
            &lt;p/&gt;
          &lt;/div&gt;
          &lt;div id=&quot;btnCnt_static_pg&quot;&gt;
            &lt;div id=&quot;buttonContent&quot; class=&quot;button-group&quot;&gt;
              &lt;button class=&quot;button gray medium&quot; onclick=&quot;resetForm()&quot; toolTipId=&quot;271&quot;&gt;
                &lt;span textId=&quot;584&quot;/&gt;
              &lt;/button&gt;
              &lt;button class=&quot;button gray medium&quot; onclick=&quot;resetToDefaults()&quot; toolTipId=&quot;272&quot;&gt;
                &lt;span textId=&quot;1002&quot;/&gt;
              &lt;/button&gt;
              &lt;button class=&quot;button gray medium&quot; onclick=&quot;viewModifications()&quot; toolTipId=&quot;273&quot;&gt;
                &lt;span textId=&quot;1003&quot;/&gt;
              &lt;/button&gt;
              &lt;button class=&quot;button gray medium&quot; onclick=&quot;submitForm()&quot; toolTipId=&quot;274&quot;&gt;
                &lt;span textId=&quot;574&quot;/&gt;
              &lt;/button&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;div id=&quot;supp-info&quot; class=&quot;supp-info&quot;&gt;
          &lt;ul class=&quot;tree&quot;&gt;
            &lt;li&gt;
              &lt;a href=&quot;javascript:;&quot; class=&quot;selected&quot;&gt;
                &lt;span textId=&quot;674&quot;&gt; &lt;/span&gt;
              &lt;/a&gt;
              &lt;ul&gt;
                &lt;li&gt;
                  &lt;div style=&quot;height:130px; overflow-y: scroll;&quot;/&gt;
                &lt;/li&gt;
              &lt;/ul&gt;
            &lt;/li&gt;
            &lt;li&gt;
              &lt;a href=&quot;javascript:;&quot;&gt;
                &lt;span textId=&quot;675&quot;&gt; &lt;/span&gt;
              &lt;/a&gt;
            &lt;/li&gt;
            &lt;li&gt;
              &lt;a href=&quot;javascript:;&quot;&gt;
                &lt;span textId=&quot;676&quot;&gt; &lt;/span&gt;
              &lt;/a&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;div id=&quot;modalDialog&quot;&gt; &lt;/div&gt;
      &lt;div id=&quot;darken&quot;&gt; &lt;/div&gt;
      &lt;span id=&quot;showStartPage&quot; style=&quot;display:none;&quot;&gt;
        
      &lt;/span&gt;
      &lt;div class=&quot;popup&quot; id=&quot;popupdlg&quot; style=&quot;display:none&quot;&gt;
        &lt;div class=&quot;top-bar&quot;&gt;
          &lt;img src=&quot;images/popup_close.png&quot; id=&quot;popupimgclose&quot; width=&quot;16&quot; height=&quot;16&quot; align=&quot;right&quot; class=&quot;popup-closer&quot;/&gt;
        &lt;/div&gt;
        &lt;div class=&quot;popup-content&quot;&gt;
          &lt;p/&gt;
        &lt;/div&gt;
        &lt;div class=&quot;btn-popup-actions&quot;&gt;
          &lt;p/&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;span id=&quot;isChinesePhone&quot; style=&quot;display:none&quot;&gt;
        0
      &lt;/span&gt;
      &lt;div class=&quot;previewpopup&quot; id=&quot;previewpopupdlg&quot; style=&quot;display:none&quot;/&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>