title: How to click on Element in Canvas using Selenium Python
body: <p>I am trying to click on first canvas element but it is not taking any click. I tried by following ways:</p>
  
  <p><strong>First way</strong></p>
  
  <pre><code>menu = driver.find_element_by_xpath("*//div[@id = 'cy']/div/canvas")
  ActionChains(driver).move_to_element(menu).perform()
  </code></pre>
  
  <p><strong>Second Way</strong></p>
  
  <pre><code>driver.find_element_by_xpath("*//div[@id = 'cy']/div/canvas").click()
  </code></pre>
  
  <p>Here is the html code:</p>
  
  <pre><code>&lt;div id="cy"&gt;
  &lt;div style="position: absolute; z-index: 0; overflow: hidden; width: 1029px; height: 130px;"&gt;
  &lt;canvas style="position: absolute; z-index: 5; width: 1029px; height: 130px;" data-id="layer0-selectbox" width="1029" height="130"&gt;&lt;/canvas&gt;
  &lt;canvas style="position: absolute; z-index: 4; width: 1029px; height: 130px;" data-id="layer1" width="1029" height="130"&gt;&lt;/canvas&gt;
  &lt;canvas style="position: absolute; z-index: 3; width: 1029px; height: 130px;" data-id="layer2-drag" width="1029" height="130"&gt;&lt;/canvas&gt;
  &lt;canvas style="position: absolute; z-index: 2; width: 1029px; height: 130px;" data-id="layer3" width="1029" height="130"&gt;&lt;/canvas&gt;
  &lt;canvas style="position: absolute; z-index: 1; width: 1029px; height: 130px;" data-id="layer4-node" width="1029" height="130"&gt;&lt;/canvas&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>