i'm currently facing issue with selenium getting the exact xpath on a javascript button and appreciate if someone could enlighten me or guide me.
As you can see from the image, the highlighted ones are the javascript button. what i'm planning to do is to use selenium to find buttons that are showing "bill" and click into it to clear the status.

my current codes are
while True:
try:
driver.find_element_by_xpath("//*[@id='main']/div/div/div[2]/div/div[2]/table/tbody/tr[1]/td[12]/a[1]")
except NoSuchElementException:
driver.refresh()
time.sleep(5)
else:
time.sleep(3)
driver.find_element_by_xpath("//*[@id='main']/div/div/div[2]/div/div[2]/table/tbody/tr[1]/td[12]/a[1]").click()
What i want it to do is to search for the "bill" button and if is not found, keep refreshing the page until "bill" button appear, then click on it which will bring it to another page. Do take note that it can be more than 1 "bill" button appearing (still have not figure out how to code for that part as well but i would want it to click on the row that appear the "bill" button with the earlier timing first which will bring to another page and after clearing on that page which will forward back to this page and proceed with the 2nd "bill" button etc.)
what happen now with my code is that the xpath element is only on the first row of "bill" button which it also can be "check" button being on the first row at the same position. And like i mention earlier on there could be multiple "bill" button coming so i'm not sure how to solve for that.
this are the html i get from inspecting from chrome browser for the "bill" button.
<a href="javascript:;" onclick="showContent('billing','/info/bill/12');" class="btn btn-danger btn-sm">
<span class="glyphicon glyphicon-card">
</span>
bill
</a>
Really really appreciate if someone can help me out on this. thanks