Я пытаюсь щелкнуть ссылку в таблице / td
, но получаю сообщение об ошибке при использовании селена в Python
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.action_chains import ActionChains
import selenium.webdriver.common.actions
import time
driver = webdriver.Firefox(executable_path="/Users/pro/Downloads/geckodriver")
driver.get("http://10.23.0.68/Netspan/Startup/Login.aspx")
driver.find_element_by_id('login_txtUsername').send_keys('admin')
driver.find_element_by_id('login_txbPassword').send_keys('password')
driver.find_element_by_id('login_btnLogin').click()
search=driver.find_element_by_id("SearchBox")
elements = search.send_keys("C5x_Ft_V")
driver.implicitly_wait(10)
ActionChains(driver).move_to_element(driver.find_element_by_id('SearchResultLink1')).click().perform()
driver.implicitly_wait(15)
driver.find_elements_by_id("ctl00_contentBody_ctl01_ucBsAction_pnhProv_btnReprov").click()
AttributeError: объект 'list' не имеет атрибута ' click '
Ниже приведен HTML код таблицы, я попытался вставить весь код, но он был 50K +, поэтому вставил это - Пожалуйста, поддержите, если есть возможность найти идентификатор или xpath.
<tbody><tr id="ctl00_contentBody_ctl01_ucBsAction_pnhProvHR">
<td id="ctl00_contentBody_ctl01_ucBsAction_pnhProvHD" style="vertical-align:top;width:100%;"><table id="ctl00_contentBody_ctl01_ucBsAction_pnhProv_Header" onclick="OnClk_ctl00_contentBody_ctl01_ucBsAction_pnhProv();" class="ExPanelHeader_exp" cellpadding="0" cellspacing="0" style="width:100%;">
<tbody><tr>
<td nowrap="" align="Left" style="width:100%;"><span id="ctl00_contentBody_ctl01_ucBsAction_pnhProv_htxt" class="ExPanelHeader_exp_txt" style="text-align:left;">Reprovisioning and Actions</span></td><td nowrap="" class="panelHeader"><span id="pnhProv_cbtn" class="ExPanelHeader_exp_ctrl fa fa-chevron-circle-up text-white ml-1 mr-1" align="right"></span></td>
</tr>
</tbody></table></td>
</tr><tr id="ctl00_contentBody_ctl01_ucBsAction_pnhProvCR" style="height:auto;">
<td id="ctl00_contentBody_ctl01_ucBsAction_pnhProv" class="ExPanelContents fillY" style="width:100%;height:100%;vertical-align:top;">
<div id="ctl00_contentBody_ctl01_ucBsAction_pnhProv_udpProv">
<div style="margin: 1px">
</div>
<table>
<colgroup>
<col style="width: 90px">
<col>
<col>
<col>
</colgroup>
<tbody><tr id="ctl00_contentBody_ctl01_ucBsAction_pnhProv_tbrState">
<td class="Table_ColLbl">
<span id="ctl00_contentBody_ctl01_ucBsAction_pnhProv_lblProvState" class="ExLabel">State</span></td>
<td class="Table_ColCtrl">
<input name="ctl00$contentBody$ctl01$ucBsAction$pnhProv$txbProvState" type="text" value="OK" readonly="readonly" id="ctl00_contentBody_ctl01_ucBsAction_pnhProv_txbProvState" class=" ExTextBox_ro" blockenter="true" style="width:180px;"></td>
<td class="Table_ColCtrl">
<input id="ctl00_contentBody_ctl01_ucBsAction_pnhProv_btnReprov" class="btn btn-sm btn-light" onclick="ExMsgPanel_Hide();if(typeof(Page_ClientValidate) == 'function') {if(typeof(SetupValidatorsAfterAsync) == 'function') {SetupValidatorsAfterAsync()};if (!Page_ClientValidate()) return;}__doPostBack('ctl00$contentBody$ctl01$ucBsAction$pnhProv$btnReprov','')" type="button" value="Re-provision" name="ctl00$contentBody$ctl01$ucBsAction$pnhProv$btnReprov" style="width:100px;vertical-align:top;"></td>
<td class="Table_ColCtrl">
</td>
</tr>
<tr id="ctl00_contentBody_ctl01_ucBsAction_pnhProv_tbrAction">
<td class="Table_ColLbl">
<span id="ctl00_contentBody_ctl01_ucBsAction_pnhProv_ExLabel1" class="ExLabel">Action</span>
</td>
<td class="Table_ColCtrl">
<select name="ctl00$contentBody$ctl01$ucBsAction$pnhProv$ddlAction" id="ctl00_contentBody_ctl01_ucBsAction_pnhProv_ddlAction" onchange="LinkListCtrlToButton(this, 0, 'ctl00_contentBody_ctl01_ucBsAction_pnhProv_btnActionQueue');" class="ExDropDown chosen-hidden" onclick="if(typeof(Page_ClientValidate) == 'function') {Page_ValidationActive = false;}" style="">
<option selected="selected" value="0">(none)</option>
<option value="1">Reset Node</option>
</select><div class="chosen-container chosen-container-single chosen-container-single-nosearch" title="" id="ctl00_contentBody_ctl01_ucBsAction_pnhProv_ddlAction_chosen" style="width: 96px;"><a class="chosen-single">
<span>(none)</span>
<div><b></b></div>
</a>
<div class="chosen-drop">
<div class="chosen-search">
<input class="chosen-search-input" type="text" autocomplete="off" readonly="" blockenter="true">
</div>
<ul class="chosen-results"></ul>
</div></div>
</td>
<td class="Table_ColCtrl">
<input id="ctl00_contentBody_ctl01_ucBsAction_pnhProv_btnActionQueue" disabled="disabled" class="btn btn-sm btn-light" onclick="ExMsgPanel_Hide();if(typeof(Page_ClientValidate) == 'function') {if(typeof(SetupValidatorsAfterAsync) == 'function') {SetupValidatorsAfterAsync()};if (!Page_ClientValidate()) return;}__doPostBack('ctl00$contentBody$ctl01$ucBsAction$pnhProv$btnActionQueue','')" type="button" value="Queue Action" name="ctl00$contentBody$ctl01$ucBsAction$pnhProv$btnActionQueue" style="width:100px;vertical-align:top;">
</td>
<td class="Table_ColCtrl">
<input id="ctl00_contentBody_ctl01_ucBsAction_pnhProv_btnActionClearErrored" title="Clears Action failures (From Change Type Action)" class="btn btn-sm btn-light" onclick="ExMsgPanel_Hide();if(typeof(Page_ClientValidate) == 'function') {if(typeof(SetupValidatorsAfterAsync) == 'function') {SetupValidatorsAfterAsync()};if (!Page_ClientValidate()) return;}__doPostBack('ctl00$contentBody$ctl01$ucBsAction$pnhProv$btnActionClearErrored','')" type="button" value="Clear Failed Actions" name="ctl00$contentBody$ctl01$ucBsAction$pnhProv$btnActionClearErrored" style="vertical-align:top;">
<input id="ctl00_contentBody_ctl01_ucBsAction_pnhProv_btnActionCancel" title="Cancels pending actions which are queued for processing" class="btn btn-sm btn-light" onclick="ExMsgPanel_Hide();if(typeof(Page_ClientValidate) == 'function') {if(typeof(SetupValidatorsAfterAsync) == 'function') {SetupValidatorsAfterAsync()};if (!Page_ClientValidate()) return;}__doPostBack('ctl00$contentBody$ctl01$ucBsAction$pnhProv$btnActionCancel','')" type="button" value="Cancel Actions" name="ctl00$contentBody$ctl01$ucBsAction$pnhProv$btnActionCancel" style="vertical-align:top;">
</td>
</tr>
</tbody></table>
<table style="width: 100%">
<colgroup>
<col style="width: 90px">
<col>
</colgroup>
<tbody><tr id="ctl00_contentBody_ctl01_ucBsAction_pnhProv_tbrStatistics">
<td class="Table_ColLbl" valign="top">
<span id="ctl00_contentBody_ctl01_ucBsAction_pnhProv_lblProvStats" class="ExLabel">Statistics</span></td>
<td class="Table_ColCtrl" valign="top">
<div class="ExUpExpand" id="udpProvStats">
<table id="ctl00_contentBody_ctl01_ucBsAction_pnhProv_tblProvStats" class="statsTable outer" border="0">
<tbody><tr class="statsTable header">
<th class="statsTable header" style="width:20px;"></th><th class="statsTable header" align="center" style="width:100px;">Change Type</th><th class="statsTable header" align="center" style="width:60px;">Pending</th><th class="statsTable header" align="center" style="width:60px;">Queued</th><th class="statsTable header" align="center" style="width:60px;">Failed</th>
</tr><tr class="statsTable">
<td class="statsTable left" style="background-color:#FFFFFF;">1</td><td class="statsTable" style="background-color:#FFFFFF;width:100px;">iBridge 440</td><td class="statsTable" style="background-color:#FFFFFF;width:60px;">0</td><td class="statsTable" style="background-color:#FFFFFF;width:60px;">0</td><td class="statsTable" style="background-color:#FFFFFF;width:60px;">0</td>
</tr><tr class="statsTable">
<td class="statsTable left" style="background-color:#F6F6F6;">2</td><td class="statsTable" style="background-color:#F6F6F6;width:100px;">Action</td><td class="statsTable" style="background-color:#F6F6F6;width:60px;">0</td><td class="statsTable" style="background-color:#F6F6F6;width:60px;">0</td><td class="statsTable" style="background-color:#F6F6F6;width:60px;">0</td>
</tr>
</tbody></table>
<input id="btnProvStatsReload" accesskey="R" class="btn btn-sm btn-light" onclick="if(typeof(Page_ClientValidate) == 'function') {Page_ValidationActive = false;}__doPostBack('ctl00$contentBody$ctl01$ucBsAction$pnhProv$btnProvStatsReload','')" type="button" value="Reload" name="ctl00$contentBody$ctl01$ucBsAction$pnhProv$btnProvStatsReload" style="width:80px;vertical-align:top;margin: 1px">
</div>
</td>
</tr>
</tbody></table>
</div>
<input name="ctl00$contentBody$ctl01$ucBsAction$pnhProv$hiexp" type="hidden" id="ctl00_contentBody_ctl01_ucBsAction_pnhProv_hiexp" value="true"><input name="ctl00$contentBody$ctl01$ucBsAction$pnhProv$ttlclp" type="hidden" id="ctl00_contentBody_ctl01_ucBsAction_pnhProv_ttlclp"><input name="ctl00$contentBody$ctl01$ucBsAction$pnhProv$ttlexp" type="hidden" id="ctl00_contentBody_ctl01_ucBsAction_pnhProv_ttlexp" value="Reprovisioning and Actions"></td>
</tr>
<script language="javascript">
function OnFocus_ctl00_contentBody_ctl01_ucBsAction_pnhProv(){var pn=GetEl("ctl00_contentBody_ctl01_ucBsAction_pnhProv");var pnh=GetEl("ctl00_contentBody_ctl01_ucBsAction_pnhProv_Header");var pnht=GetEl("ctl00_contentBody_ctl01_ucBsAction_pnhProv_htxt");var pnhh=null;var pnhc=GetEl("pnhProv_cbtn");var ttlexp=GetEl("ctl00_contentBody_ctl01_ucBsAction_pnhProv_ttlexp");var ttlclp=GetEl("ctl00_contentBody_ctl01_ucBsAction_pnhProv_ttlclp");var hiexp=GetEl("ctl00_contentBody_ctl01_ucBsAction_pnhProv_hiexp");var imgexp="fa fa-chevron-circle-up text-white ml-1 mr-1";var imgclp="fa fa-chevron-circle-down text-white ml-1 mr-1";if(hiexp.value!="true"){ExHeaderPanel_DoExp(pn,pnh,pnht,pnhh,pnhc,ttlexp,imgexp);hiexp.value="true";}}
</script>
</tbody>