[Tutor] Fwd: Question about selenium with python
Fazal Khan
fazal.h.khan at gmail.com
Tue Dec 20 20:29:54 EST 2016
Hello,
Im a new programmer and this is my first time posting here. I have a
question about using selenium with python. My first question is how do I
get selenium to click on a link contained within a specific cell of a
table? I know how to get selenium to click on a link in general but in this
case there are several links which have the same name, but each of these
links are in a different cell. Basically Id like to give selenium the
location of a specific cell, and then tell it to click on the link inside
that cell.
Lets say the link is located in the 3nd row and 3nd column of a table. I
tried the following code but it didnt work
link = driver.find_element_by_xpath("//tr[3]/td[3]")
link.click()
Thanks
Fuzz
heres an example of the HTML code im working with:
</form><table class="table">
<tr>
<tr>
<th>
<a href="/RadOncProton/2ndcheck_mca/MCR/Patients?sortOrder=
Name">Name</a>
</th>
<th>
<a href="/RadOncProton/2ndcheck_mca/MCR/Patients?sortOrder=clinicnum_desc">Clinic
#</a>
</th>
<th>
</th>
</tr>
<tr>
<td>
Name1
</td>
<td>
MRN1
</td>
<td>
<a href="/RadOncProton/2ndcheck_
mca/MCR/Plans/Index/743">Plans</a>
</td>
<td>
<b> | </b>
<a href="/RadOncProton/2ndcheck_
mca/MCR/Patients/Delete/743">Delete</a>
</td>
</tr>
More information about the Tutor
mailing list