title: Python Selenium Javascript Link Click Fails to Execute
body: <p>I am using Selenium for Python with the PhantomJS Ghost Driver in order to click links which have Javascript in the href, such as the links from <a href="https://structuredginniemaes.ginnienet.com/Download/" rel="nofollow">this</a> link.  I can get the link just fine as an element, but when I try to click it, things go wrong.  Here's some code (note - url is a list, where the first element is the Jscript link and the second is the link text)</p>
  
  <pre><code>def get_jscript_down(self,url):
      driver = webdriver.PhantomJS()
      print(self.exact_url)
      driver.get(self.exact_url)
      elements = driver.find_elements_by_tag_name("a")
      for ele in elements:
          if ele.text == url[1].encode("utf-8").replace("  "," "):
              break
      ele.click()
      print("Cannot yet download %s" % url)
  
      return False
  </code></pre>
  
  <p>Everything works as I need it to except for ele.click().  When I execute that, I get an ugly looking WebDriverException.</p>
  
  <p><code>
  selenium.common.exceptions.WebDriverException: Message: u'Error Message => \'Click failed: ReferenceError: Can\'t find variable: __doPostBack\'\n caused by Request => {"headers":{"Accept":"application/json","Accept-Encoding":"identity","Connection":"close","Content-Length":"81","Content-Type":"application/json;charset=UTF-8","Host":"127.0.0.1:34441","User-Agent":"Python-urllib/2.6"},"httpVersion":"1.1","method":"POST","post":"{\"sessionId\": \"71c20b50-ca21-11e2-a03c-f58c49e5a1bc\", \"id\": \":wdc:1370025577147\"}","url":"/click","urlParsed":{"anchor":"","query":"","file":"click","directory":"/","path":"/click","relative":"/click","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/click","queryKey":{},"chunks":["click"]},"urlOriginal":"/session/71c20b50-ca21-11e2-a03c-f58c49e5a1bc/element/%3Awdc%3A1370025577147/click"}' ; Screenshot: available via screen 
  </code></p>
  
  <p>I'm not really sure why this click is failing.  As far as I have read, I should be okay using click in that way.  Below is the relevant portion of the stack trace (from right before things start breaking to the end)</p>
  
  <pre>
  line 283, in get_jscript_down
      ele.click()
    File "/usr/local/lib/python2.6/dist-packages/selenium/webdriver/remote/webelement.py", line 54, in click
      self._execute(Command.CLICK_ELEMENT)
    File "/usr/local/lib/python2.6/dist-packages/selenium/webdriver/remote/webelement.py", line 228, in _execute
      return self._parent.execute(command, params)
    File "/usr/local/lib/python2.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 165, in execute
      self.error_handler.check_response(response)
    File "/usr/local/lib/python2.6/dist-packages/selenium/webdriver/remote/errorhandler.py", line 158, in check_response
      raise exception_class(message, screen, stacktrace)
  </pre>
  
  <p>Any ideas will be much appreciated.  I'm fairly stumped.</p>