【发布时间】:2020-03-04 00:42:19
【问题描述】:
我有以下元素:
<td id="content_gvNewLeads_tccell25_5" class="dxgv dx-ellipsis" align="left" style="border-bottom-width:0px;">
<a onclick="return ShowCallDialog(493325, 7);">9 Via Cancion </a>
</td>
在这种情况下,我需要获取“onclick”中的值return ShowCallDialog(493325, 7)
Following this answer 我试图这样做:
allElements = driver.find_elements(By.XPATH, "//*[starts-with(@id,'content_gvNewLeads_tccel')]/a").getAttribute("onclick")
我收到一个错误:
AttributeError: 'list' object has no attribute 'getAttribute'
有什么想法可以做到这一点吗?
【问题讨论】:
标签: selenium