Python selenium webdriver选择href选择部分文本

Python selenium webdriver选择href选择部分文本,python,css,selenium,element,partial,Python,Css,Selenium,Element,Partial,我正在Ubuntu 20.04上使用Python 3.8.5。使用chrome上的selenium webdriver,我想通过指定此元素中包含的许可证ID编号(1467250)来下载附件: <a xmlns="http://www.w3.org/1999/xhtml" href="#" onclick="if(typeof jsfcljs == 'function'){jsfcljs(document.forms['myApplicati

我正在Ubuntu 20.04上使用Python 3.8.5。使用chrome上的selenium webdriver,我想通过指定此元素中包含的
许可证ID
编号(1467250)来下载附件:

<a xmlns="http://www.w3.org/1999/xhtml" href="#" onclick="if(typeof jsfcljs == 'function'){jsfcljs(document.forms['myApplicationsResultsForm'],'myApplicationsResultsForm:searchResultsTable:0:j_id339:0:j_id340,myApplicationsResultsForm:searchResultsTable:0:j_id339:0:j_id340,licenceId,1467250,statusHistoryId,2600790,fileName,ROL_1467250_20200817-142839.pdf,attachmentType,ROL','');}return false" class="pageLink"><img src="/oplinc2/images/pdf.jpg" alt="ROL_1467250_20200817-142839.pdf" height="24" style="border-width: 0px;" title="ROL_1467250_20200817-142839.pdf" width="24" /></a>
我是否能够使用元素中的部分文本来查找和下载附件,例如
许可证ID,1467250
?有很多这样的附件。我尝试了部分文本示例,但这不适用于我:

>>> driver.find_element_by_partial_link_text('1467250')

NoSuchElementException: Message: no such element: Unable to locate element: {"method":"partial link text","selector":"1467250"}
编辑 这个问题类似于@Ajay link to,只是这个元素的href略有不同。仍然不确定如何在单击时访问
onclick

试试这个

links = driver.find_elements_by_partial_link_text('https://websites.com/activation.php?a=act')

for link in links:
    print(link.get_attribute("href"))

*
替换
a
将查找元素。

您能提供指向该网页的链接吗?对不起,这是一个用户名和密码为
find\u elements\u by\u partial\u link\u text
的私人帐户。这是否回答了您的问题?
links = driver.find_elements_by_partial_link_text('https://websites.com/activation.php?a=act')

for link in links:
    print(link.get_attribute("href"))
driver.find_element_by_xpath('//*[contains(@onclick, "1467250")]')