title: Call a Javascript function in Python - Selenium
body: <p>I have this HTML code I'm proccesing/scrapping with a python script:</p>
  
  <pre><code>&lt;a href="javascript:VerMapa('AVDA. DE AMERICA, 2  -33880 POLA DE ALLANDE','RODRIGUEZ-PELAEZ PEÑA, ANA MARIA','AVDA. DE AMERICA, 2  -33880','33880','ALLANDE','183','178')"&gt;&lt;img src="../../Fijos/Img/VerMapa.jpg" alt="" width="25" height="24" border="0"&gt;&amp;nbsp;&lt;br&gt;Ver Mapa&lt;/a&gt;
  </code></pre>
  
  <p>This is the definition of the function:</p>
  
  <pre><code>function VerMapa(direccion,farmacia,domicilio,CP,municipio, numeroOficina,identidad) {
      window.open("googleMaps.aspDir="+direccion+"&amp;Far="+farmacia+"&amp;Dom="+domicilio+"&amp;CP="+CP+"&amp;Mun="+municipio+"&amp;NO="+numeroOficina+"&amp;Id="+identidad+"&amp;",'Lista','toolbar=no, menubar=no, scrollbars=yes,resizable=yes,status=yes,screenX=50,top=50,width=740,height=530');
  }
  </code></pre>
  
  <p>I need to make a call to <code>VerMapa('AVDA. DE AMERICA, 2  -33880 POLA DE ALLANDE','RODRIGUEZ-PELAEZ PEÑA, ANA MARIA','AVDA. DE AMERICA, 2  -33880','33880','ALLANDE','183','178')</code> javascript function in the href attribute and get the HTML code returned.</p>
  
  <p>I have checked spider-monkey and PyV8 but I think they can't help me here. spider-monkey is clear  telling you can´t call a javascript defined function.</p>
  
  <p>I'm now trying with Selenium, but I don't know how I can get the source code back to python.</p>
  
  <p>By know I just have implemented a test script and managed to load the requested page in a browser window.</p>
  
  <pre><code>from selenium import webdriver
  browser = webdriver.Firefox()
  browser.get("http://www.farmasturias.org/GESCOF/cms/Guardias/FarmaciaBuscar.asp?IdMenu=111")
  htmlCode = browser.execute_script("return VerMapa('AVDA. DE AMERICA, 2  -33880 POLA DE ALLANDE','RODRIGUEZ-PELAEZ PEÑA, ANA MARIA','AVDA. DE AMERICA, 2  -33880','33880','ALLANDE','183','178')")
  print htmlCode;
  </code></pre>
  
  <p>1.- I am not getting anything in htmlCode var. ¿How can I get back the source code  generated by the javascript function? I have taken the syntax from this post <a href="https://stackoverflow.com/questions/5585343/getting-the-return-value-of-javascript-code-in-selenium/5585345#5585345">Getting the return value of Javascript code in Selenium</a></p>
  
  <p>2.- Is there any way to use Selenium without opening any browser window?</p>