i try to write a code which click on several links in a table.
Here is the HTML Code:
<div id="gadget-34365" class="gadget-inline" style="height: 905px;">
<div class="results-wrap search-results-dashboard-item">
<div class="search-results-dashboard-item-issue-table ">
<issuetable-web-component>
<table class="issue-table">
<thead></thead>
<tbody>
<tr rel="548420" data-issuekey="SOLI-30715" class="issuerow"></tr>
<tr rel="532948" data-issuekey="SOLI-29811" class="issuerow"></tr>
<tr rel="548424" data-issuekey="SOLI-30719" class="issuerow">
<td class="priority"></td>
<td class="issuetype"></td>
<td class="issuekey">
<a class="issue-link" data-issue-key="SOLI-30719" href="https://jira.t-systems-mms.eu/browse/SOLI-30719">SOLI-30719</a>
</td>
<td class="summary"></td>
<td class="status"></td>
<td class="customfield_10090">
<span title="26.12.17">
<time datetime="2017-12-26">26.12.17</time>
</span>
</td>
<td class="issue_actions"> </td>
</tr>
<tr rel="553117" data-issuekey="SOLI-31203" class="issuerow"></tr>
<tr rel="550261" data-issuekey="SOLI-30912" class="issuerow"></tr>
</tbody>
</table>
</issuetable-web-component>
</div>
</div>
My Code should check the table in the column "customfield_10090" if the project has to be done in the next two weeks. After that it should click on the link in column "issuekey".
This is my Code so far:
td_list = WebDriverWait(driver, 10).until(lambda driver: driver.find_elements_by_css_selector("#gadget-34365 > div > div"))
for td in td_list:
time = driver.find_elements_by_tag_name("time")
for row in driver.find_elements_by_css_selector("#gadget-34365 > div > div > issuetable-web-component > table > tbody > tr:nth-child(7) > td.customfield_10090"):
if time == now or now <= date_in_two_weeks:
for cell in driver.find_elements_by_class_name("issuekey"):
Link = driver.find_element_by_link_text("SOLI")
Link.click()
driver.get_screenshot_as_file("Test.png")
else:
print "No Projects found in the next two weeks !"
I tried every single solution i could find here, but nothing could solve my problem.
What i´m missing or is wrong? Hope some one can help :)
EDIT:
This is the error i get:
Traceback (most recent call last):
File "comment.py", line 42, in <module>
Link = driver.find_element_by_link_text("SOLI")
File "/usr/local/lib/python2.7/dist packages/selenium/webdriver/remote/webdriver.py", line 389, in find_element_by_link_text
return self.find_element(by=By.LINK_TEXT, value=link_text)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 843, in find_element
'value': value})['value']
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 308, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 194, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element:
Unable to locate element: {"method":"link text","selector":"SOLI"}
(Session info: chrome=62.0.3202.75)
(Driver info: chromedriver=2.26.436382
(70eb799287ce4c2208441fc057053a5b07ceabac),platform=Linux 4.9.17-c9 x86_64)