How to call javascript function with Python Selenium?

I want to call MapITRFtoWgs84() function multiple times, actually giving input from a text file and write the output to the another text file? I think Selenium is appropirate tool for my goal. How can I do that? Here is the photo of the calling function from chrome console: ss of chrome console

Answer

   driver.execute_script("MapITRFtoWgs84()") or 
   driver.execute_script("$.MapITRFtoWgs84()") or 
   driver.execute_script("document.MapITRFtoWgs84()") 

Try any of the above methods , it depends on whether jquery is exported in the page . Else you will get $ not defined error .

Leave a Reply

Your email address will not be published. Required fields are marked *