如何使用python selenium从以下HTML中单击最后一个id元素?

时间:2018-04-01 06:21:03

标签: python-3.x selenium

HTML代码

<div id="folders-navigation-list" class="seapine-theme sc-view sc-collection-view sc-list-view focus collection" style="left: 0px; right: 0px; top: 0px; bottom: 0px; min-height: 408px; "><div id="folders-navigation-list-0" class="seapine-theme sc-view sc-list-item-view folders-navigation-item sc-collection-item even has-disclosure has-icon sc-regular-size" style="left: 0px; right: 0px; top: 0px; height: 24px; "><div class="sc-outline" style="left: 16px; "><div aria-labelledby="sc14818-label" class="sc-disclosure-view sc-regular-size seapine-theme disclosure sel"><div class="disclosure-label"><img src="data:image/gif;base64,R0lGODlhAQABAJAAAP///wAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw==" class="disclosure button open"><span id="sc14818-label" class="sc-button-label sc-disclosure-label sc-regular-size" style=""></span></div></div><img src="data:image/gif;base64,R0lGODlhAQABAJAAAP///wAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw==" class="public-folder-icon icon"><label>Public</label></div></div><div id="folders-navigation-list-1" class="seapine-theme sc-view sc-list-item-view folders-navigation-item sc-collection-item odd has-disclosure has-icon sel sc-regular-size" style="left: 0px; right: 0px; top: 24px; height: 24px; "><div class="sc-outline" style="left: 32px; "><div aria-labelledby="sc14819-label" class="sc-disclosure-view sc-regular-size seapine-theme disclosure sel"><div class="disclosure-label"><img src="data:image/gif;base64,R0lGODlhAQABAJAAAP///wAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw==" class="disclosure button open"><span id="sc14819-label" class="sc-button-label sc-disclosure-label sc-regular-size" style=""></span></div></div><img src="/cgi-bin/ttcgi.exe?requestType=GetGraphicFile&amp;cookie=APOEJJLEAHLOGHILAPPJIHNPAGPLGNLBANCGCAMHAFLOKDPIC&amp;serverName=Default&amp;symmetricKey=B25zIhoyfADKfa0PJFXU9wBOSYhGnZ24z8qtc%2B55CQmyZOQU%2FI%2FvGlmWbmaeSUZZAFKg75vVweiDq6wqLhO2jw%3D%3D&amp;folderIcon=1&amp;folderType=2&amp;folderClosed=0&amp;cache_buster=1522561633138" class=" icon"><label>SL Control App</label></div></div><div id="folders-navigation-list-2" class="seapine-theme sc-view sc-list-item-view folders-navigation-item sc-collection-item even has-icon sc-regular-size" style="left: 0px; right: 0px; top: 48px; height: 24px; "><div class="sc-outline" style="left: 48px; "><img src="data:image/gif;base64,R0lGODlhAQABAJAAAP///wAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw==" class="default-closed-folder-icon icon"><label>Papierkorb</label></div></div><div id="folders-navigation-list-3" class="seapine-theme sc-view sc-list-item-view folders-navigation-item sc-collection-item odd has-disclosure has-icon sc-regular-size" style="left: 0px; right: 0px; top: 72px; height: 24px; "><div class="sc-outline" style="left: 48px; "><div aria-labelledby="sc14820-label" class="sc-disclosure-view sc-regular-size seapine-theme disclosure"><div class="disclosure-label"><img src="data:image/gif;base64,R0lGODlhAQABAJAAAP///wAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw==" class="disclosure button closed"><span id="sc14820-label" class="sc-button-label sc-disclosure-label sc-regular-size" style=""></span></div></div><img src="/cgi-bin/ttcgi.exe?requestType=GetGraphicFile&amp;cookie=APOEJJLEAHLOGHILAPPJIHNPAGPLGNLBANCGCAMHAFLOKDPIC&amp;serverName=Default&amp;symmetricKey=B25zIhoyfADKfa0PJFXU9wBOSYhGnZ24z8qtc%2B55CQmyZOQU%2FI%2FvGlmWbmaeSUZZAFKg75vVweiDq6wqLhO2jw%3D%3D&amp;folderIcon=1&amp;folderType=10&amp;folderClosed=1&amp;cache_buster=1522561633138" class=" icon"><label>Impediments</label></div></div><div id="folders-navigation-list-4" class="seapine-theme sc-view sc-list-item-view folders-navigation-item sc-collection-item even has-disclosure has-icon sc-regular-size" style="left: 0px; right: 0px; top: 96px; height: 24px; "><div class="sc-outline" style="left: 48px; "><div aria-labelledby="sc14821-label" class="sc-disclosure-view sc-regular-size seapine-theme disclosure"><div class="disclosure-label"><img src="data:image/gif;base64,R0lGODlhAQABAJAAAP///wAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw==" class="disclosure button closed"><span id="sc14821-label" class="sc-button-label sc-disclosure-label sc-regular-size" style=""></span></div></div><img src="data:image/gif;base64,R0lGODlhAQABAJAAAP///wAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw==" class="default-closed-folder-icon icon"><label>Risks</label></div></div><div id="folders-navigation-list-5" class="seapine-theme sc-view sc-list-item-view folders-navigation-item sc-collection-item odd has-icon sc-regular-size" style="left: 0px; right: 0px; top: 120px; height: 24px; "><div class="sc-outline" style="left: 48px; "><img src="data:image/gif;base64,R0lGODlhAQABAJAAAP///wAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw==" class="default-closed-folder-icon icon"><label>UX Scenarios</label></div></div><div id="folders-navigation-list-6" class="seapine-theme sc-view sc-list-item-view folders-navigation-item sc-collection-item even has-icon sc-regular-size" style="left: 0px; right: 0px; top: 144px; height: 24px; "><div class="sc-outline" style="left: 48px; "><img src="data:image/gif;base64,R0lGODlhAQABAJAAAP///wAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw==" class="default-closed-folder-icon icon"><label>Scenarios</label></div></div><div id="folders-navigation-list-7" class="seapine-theme sc-view sc-list-item-view folders-navigation-item sc-collection-item odd has-icon sc-regular-size" style="left: 0px; right: 0px; top: 168px; height: 24px; "><div class="sc-outline" style="left: 48px; "><img src="/cgi-bin/ttcgi.exe?requestType=GetGraphicFile&amp;cookie=APOEJJLEAHLOGHILAPPJIHNPAGPLGNLBANCGCAMHAFLOKDPIC&amp;serverName=Default&amp;symmetricKey=B25zIhoyfADKfa0PJFXU9wBOSYhGnZ24z8qtc%2B55CQmyZOQU%2FI%2FvGlmWbmaeSUZZAFKg75vVweiDq6wqLhO2jw%3D%3D&amp;folderIcon=1&amp;folderType=5&amp;folderClosed=1&amp;cache_buster=1522561633138" class=" icon"><label>Story Backlog</label></div></div><div id="folders-navigation-list-8" class="seapine-theme sc-view sc-list-item-view folders-navigation-item sc-collection-item even has-icon sc-regular-size" style="left: 0px; right: 0px; top: 192px; height: 24px; "><div class="sc-outline" style="left: 48px; "><img src="/cgi-bin/ttcgi.exe?requestType=GetGraphicFile&amp;cookie=APOEJJLEAHLOGHILAPPJIHNPAGPLGNLBANCGCAMHAFLOKDPIC&amp;serverName=Default&amp;symmetricKey=B25zIhoyfADKfa0PJFXU9wBOSYhGnZ24z8qtc%2B55CQmyZOQU%2FI%2FvGlmWbmaeSUZZAFKg75vVweiDq6wqLhO2jw%3D%3D&amp;folderIcon=1&amp;folderType=5&amp;folderClosed=1&amp;cache_buster=1522561633138" class=" icon"><label>Story Backlog MindTree (Angular UI)</label></div></div><div id="folders-navigation-list-9" class="seapine-theme sc-view sc-list-item-view folders-navigation-item sc-collection-item odd has-disclosure has-icon sc-regular-size" style="left: 0px; right: 0px; top: 216px; height: 24px; "><div class="sc-outline" style="left: 48px; "><div aria-labelledby="sc14822-label" class="sc-disclosure-view sc-regular-size seapine-theme disclosure"><div class="disclosure-label"><img src="data:image/gif;base64,R0lGODlhAQABAJAAAP///wAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw==" class="disclosure button closed"><span id="sc14822-label" class="sc-button-label sc-disclosure-label sc-regular-size" style=""></span></div></div><img src="/cgi-bin/ttcgi.exe?requestType=GetGraphicFile&amp;cookie=APOEJJLEAHLOGHILAPPJIHNPAGPLGNLBANCGCAMHAFLOKDPIC&amp;serverName=Default&amp;symmetricKey=B25zIhoyfADKfa0PJFXU9wBOSYhGnZ24z8qtc%2B55CQmyZOQU%2FI%2FvGlmWbmaeSUZZAFKg75vVweiDq6wqLhO2jw%3D%3D&amp;folderIcon=1&amp;folderType=9&amp;folderClosed=1&amp;cache_buster=1522561633138" class=" icon"><label>Test Library</label></div></div><div id="folders-navigation-list-10" class="seapine-theme sc-view sc-list-item-view folders-navigation-item sc-collection-item even has-disclosure has-icon sc-regular-size" style="left: 0px; right: 0px; top: 240px; height: 24px; "><div class="sc-outline" style="left: 48px; "><div aria-labelledby="sc14823-label" class="sc-disclosure-view sc-regular-size seapine-theme disclosure"><div class="disclosure-label"><img src="data:image/gif;base64,R0lGODlhAQABAJAAAP///wAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw==" class="disclosure button closed"><span id="sc14823-label" class="sc-button-label sc-disclosure-label sc-regular-size" style=""></span></div></div><img src="/cgi-bin/ttcgi.exe?requestType=GetGraphicFile&amp;cookie=APOEJJLEAHLOGHILAPPJIHNPAGPLGNLBANCGCAMHAFLOKDPIC&amp;serverName=Default&amp;symmetricKey=B25zIhoyfADKfa0PJFXU9wBOSYhGnZ24z8qtc%2B55CQmyZOQU%2FI%2FvGlmWbmaeSUZZAFKg75vVweiDq6wqLhO2jw%3D%3D&amp;folderIcon=1&amp;folderType=3&amp;folderClosed=1&amp;cache_buster=1522561633138" class=" icon"><label>v0.9 Beta Release</label></div></div><div id="folders-navigation-list-11" class="seapine-theme sc-view sc-list-item-view folders-navigation-item sc-collection-item odd has-disclosure has-icon sc-regular-size" style="left: 0px; right: 0px; top: 264px; height: 24px; "><div class="sc-outline" style="left: 48px; "><div aria-labelledby="sc14824-label" class="sc-disclosure-view sc-regular-size seapine-theme disclosure"><div class="disclosure-label"><img src="data:image/gif;base64,R0lGODlhAQABAJAAAP///wAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw==" class="disclosure button closed"><span id="sc14824-label" class="sc-button-label sc-disclosure-label sc-regular-size" style=""></span></div></div><img src="/cgi-bin/ttcgi.exe?requestType=GetGraphicFile&amp;cookie=APOEJJLEAHLOGHILAPPJIHNPAGPLGNLBANCGCAMHAFLOKDPIC&amp;serverName=Default&amp;symmetricKey=B25zIhoyfADKfa0PJFXU9wBOSYhGnZ24z8qtc%2B55CQmyZOQU%2FI%2FvGlmWbmaeSUZZAFKg75vVweiDq6wqLhO2jw%3D%3D&amp;folderIcon=1&amp;folderType=3&amp;folderClosed=1&amp;cache_buster=1522561633138" class=" icon"><label>Release 1.0</label></div></div><div id="folders-navigation-list-12" class="seapine-theme sc-view sc-list-item-view folders-navigation-item sc-collection-item even has-disclosure has-icon sc-regular-size" style="left: 0px; right: 0px; top: 288px; height: 24px; "><div class="sc-outline" style="left: 48px; "><div aria-labelledby="sc14825-label" class="sc-disclosure-view sc-regular-size seapine-theme disclosure"><div class="disclosure-label"><img src="data:image/gif;base64,R0lGODlhAQABAJAAAP///wAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw==" class="disclosure button closed"><span id="sc14825-label" class="sc-button-label sc-disclosure-label sc-regular-size" style=""></span></div></div><img src="data:image/gif;base64,R0lGODlhAQABAJAAAP///wAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw==" class="default-closed-folder-icon icon"><label>Release 1.2</label></div></div><div id="folders-navigation-list-13" class="seapine-theme sc-view sc-list-item-view folders-navigation-item sc-collection-item odd has-disclosure has-icon sc-regular-size" style="left: 0px; right: 0px; top: 312px; height: 24px; "><div class="sc-outline" style="left: 48px; "><div aria-labelledby="sc14826-label" class="sc-disclosure-view sc-regular-size seapine-theme disclosure"><div class="disclosure-label"><img src="data:image/gif;base64,R0lGODlhAQABAJAAAP///wAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw==" class="disclosure button closed"><span id="sc14826-label" class="sc-button-label sc-disclosure-label sc-regular-size" style=""></span></div></div><img src="data:image/gif;base64,R0lGODlhAQABAJAAAP///wAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw==" class="default-closed-folder-icon icon"><label>Release 1.3</label></div></div><div id="folders-navigation-list-14" class="seapine-theme sc-view sc-list-item-view folders-navigation-item sc-collection-item even has-disclosure has-icon sc-regular-size" style="left: 0px; right: 0px; top: 336px; height: 24px; "><div class="sc-outline" style="left: 48px; "><div aria-labelledby="sc14827-label" class="sc-disclosure-view sc-regular-size seapine-theme disclosure"><div class="disclosure-label"><img src="data:image/gif;base64,R0lGODlhAQABAJAAAP///wAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw==" class="disclosure button closed"><span id="sc14827-label" class="sc-button-label sc-disclosure-label sc-regular-size" style=""></span></div></div><img src="data:image/gif;base64,R0lGODlhAQABAJAAAP///wAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw==" class="default-closed-folder-icon icon"><label>Release 1.4</label></div></div><div id="folders-navigation-list-15" class="seapine-theme sc-view sc-list-item-view folders-navigation-item sc-collection-item odd has-icon sc-regular-size" style="left: 0px; right: 0px; top: 360px; height: 24px; "><div class="sc-outline" style="left: 32px; "><img src="data:image/gif;base64,R0lGODlhAQABAJAAAP///wAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw==" class="default-closed-folder-icon icon"><label>Licenses</label></div></div><div id="folders-navigation-list-16" class="seapine-theme sc-view sc-list-item-view folders-navigation-item sc-collection-item even has-icon sc-regular-size" style="left: 0px; right: 0px; top: 384px; height: 24px; "><div class="sc-outline" style="left: 16px; "><img src="data:image/gif;base64,R0lGODlhAQABAJAAAP///wAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw==" class="private-folder-icon icon"><label>Private</label></div></div></div>

从上面的HTML我需要全部

  

class =“披露按钮关闭”

元素和我应该使用python selenium点击的最后一个元素。

我该怎么做?

1 个答案:

答案 0 :(得分:0)

super.retrive();