I am having problems with getting python selenium to find and click on links. I am trying to automate entering student comments into D2L. ICN_Feedback_3400653_125630 the first set of numbers is the grade item ID, and the second set of numbers is the student ID. My plan is to use take comments form gspread and paste them into d2l via selenium. But, i'm not able to click a link that pops up a java script text box.
I have tried different variations of the following:
element = driver.find_elements_by_id('ICN_Feedback_3400653_125630')
element = river.find_element_by_xpath("""//*@id="ICN_Feedback_3400653_125630"]/d2l-icon""")
element = driver.find_element_by_css_selector("#ICN_Feedback_3400653_125630")
element.click()
find_element_by_id()
doesn't work because there are 2 instances of the ID on the page, one is the link i need, and the other one is doing something?. Admittedly i am not well versed in this. Am I going about this the wrong way?
Here is the source that I am pulling from:
<div class="dco" id="z_ch" style="display:inline;float:right;"><div
class="dco_c" style="display:inline;"><a class="d2l-imagelink"
id="ICN_Feedback_3400653_125630" href="javascript:void(0);"
onclick="return false;" title="Enter comments for FIRSTNAME LASTNAME in a
new window" aria-label="Enter comments for FIRSTNAME LASTNAME in a new
window"
role="button"><d2l-icon icon="d2l-tier1:edit" class="x-scope d2l-icon-
0"><svg viewBox="0 0 18 18" preserveAspectRatio="xMidYMid meet"
focusable="false" class="style-scope d2l-icon" style="pointer-events:
none; display: block; width: 100%; height: 100%;"><g class="style-scope
d2l-icon"><path d="M2.85 10.907l-.672 1.407L.033 17.26a.535.535 0 0 0 0
.368.917.917 0 0 0 .155.184.917.917 0 0 0 .184.155A.54.54 0 0 0 .56
18a.48.48 0 0 0 .18-.033l4.946-2.145 1.407-.672 8.53-8.53-4.244-
4.243zM4.857 14l-1.515.657L4 13.143l.508-1.064 1.415 1.413zM16.707
5.537l-4.244-4.244.707-.707a2 2 0 0 1 2.83 0L17.414 2a2 2 0 0 1 0 2.83z"
class="style-scope d2l-icon"></path></g></svg></d2l-icon></a>
</div></div>