无法通过 selenium python 单击 table 中的超链接
not able to click the hyperlink in a table through selenium python
我正在尝试使用 selenium webdriver python 自动化一些东西。我在这方面取得了部分成功 so.I 在两者之间被打动了。
<td role="gridcell" style="" title="6563378117093014222" aria-describedby="devices_x1AccountId">
<a href="accountSummary?accountId=6563378117093014222">6563378117093014222</a>
</td>
我正在尝试单击 table 描述符中的超链接,但它显示了一些错误。
这是我的代码:
deviceID = browser.find_elements(By.XPATH, "//*[@aria-describedby= 'devices_billingId']/a")
deviceID.click()
我不知道我做错了什么。请提出一些解决方案
使用find_element
代替find_elements
然后在您的 xpath 中搜索 "devices_billingId" 但在您的代码中 aria-describedby 是 "devices_x1AccountId"
deviceID = browser.find_element_by_xpath("//*[@aria-describedby= 'devices_x1AccountId']/a")
deviceID.click()
我正在尝试使用 selenium webdriver python 自动化一些东西。我在这方面取得了部分成功 so.I 在两者之间被打动了。
<td role="gridcell" style="" title="6563378117093014222" aria-describedby="devices_x1AccountId">
<a href="accountSummary?accountId=6563378117093014222">6563378117093014222</a>
</td>
我正在尝试单击 table 描述符中的超链接,但它显示了一些错误。
这是我的代码:
deviceID = browser.find_elements(By.XPATH, "//*[@aria-describedby= 'devices_billingId']/a")
deviceID.click()
我不知道我做错了什么。请提出一些解决方案
使用find_element
代替find_elements
然后在您的 xpath 中搜索 "devices_billingId" 但在您的代码中 aria-describedby 是 "devices_x1AccountId"
deviceID = browser.find_element_by_xpath("//*[@aria-describedby= 'devices_x1AccountId']/a")
deviceID.click()