1 of 3

Click on an element between <span>

I am trying to automate clicking on a button of a webpage where the source code has the following structure:

<div id="ctl02_" class="sel">
   <div id="Lo" class="cont">       
      <div class="cl">         
         <span onclick="__doPostBack('ct$ctl00','M_CC_1')" 
           class="fakeLink" title="add &quot;D&quot;"> 
           <img src="Skin/D.png" alt="add &quot;D&quot;" class="io" 
           />&nbsp;D</span> <br />

I am currently trying to accomplish this with the use of python and Selenium. Below you can find how I am trying to do this:

driver = webdriver.Firefox()
driver.wait = WebDriverWait(driver, 5)

   elem = driver.wait.until(EC.presence_of_element_located((By.XPATH, "//div[@class='cl']")))
except TimeoutException:
    print("Element not found")


The program finishes fine (exit code 0), however, the webdriver has not moved to the webpage behind the click (which I would encounter if I would physically click on the buttom D on the webpage). I have tried many things giving me the feeling that I am missing something basic here.

Where am I going wrong here? Am I using Selenium in a wrong way here? Or is Selenium not the right tool for this?

Many thanks in advance.