1

I am trying to click a link on a webpage This is part of the source code:

<td height='12'><img src='/cs/cnyhcprd/cache850/PT_PIXEL_1.gif' alt='' /></td>
<td nowrap='nowrap'  valign='top' align='left'>
<DIV id='win0divDERIVED_SSS_SCR_SSS_LINK_ANCHOR3'><span  class='PSHYPERLINK'><a name='DERIVED_SSS_SCR_SSS_LINK_ANCHOR3'   id='DERIVED_SSS_SCR_SSS_LINK_ANCHOR3' tabindex='34' href="javascript:submitAction_win0(document.win0,'DERIVED_SSS_SCR_SSS_LINK_ANCHOR3');"  class='PSHYPERLINK' >Enroll</a></span>
</DIV></td>
</tr>

I have tried various variations of:

driver.find_element_by_id("win0divDERIVED_SSS_SCR_SSS_LINK_ANCHOR3").click()

My error message is essentially:

NoSuchElementException: Message: Unable to locate element:

Does anyone know what's wrong? I've been working on this issue for days already.

  • have you tried clicking straight on the link? driver.find_element_by_id("DERIVED_SSS_SCR_SSS_LINK_ANCHOR3).click() – Tudor Constantin Apr 28 '16 at 06:55
  • Yes, my bad. In my original post I have win0 in front of derived_etc. I was testing something because I thought I had the id wrong (never mind). But yes, that also doesn't work. –  Apr 28 '16 at 07:01
  • You can add few seconds of wait time before clicking or check whether your link located in `iframe` or not – Andersson Apr 28 '16 at 07:21
  • Never mind. Everything was inside a iframe - tricky. Edit: Andersson, yeah I just got it lol. Unbelievable :P –  Apr 28 '16 at 07:21

1 Answers1

0

Figured it out.

tl;dr Make sure to watch out for iFrames.