title: selenium.click() - block redirect
body: <p>I want to figure out (in a general way) the target url of a clickable element without being redirected by the browser. Is this possible in Selenium?</p>
  
  <p>Note, the clickable element generates the target url in a Javascript function. Hence, grabbing the href attribute of the element is not the solution for me.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;a href="javascript:void(0);" onclick="redirect()"&gt;click me&lt;/a&gt;
  
  &lt;script&gt;
   function redirect(){
     randomPage = Math.round(Math.random()*10000).toString()
     window.location.replace("https://jsfiddle.net/random_page_"+randomPage);  
   }
  &lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>