Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MITsVision/50b4ca3ec700eaec96cb63590882bbd6 to your computer and use it in GitHub Desktop.
Save MITsVision/50b4ca3ec700eaec96cb63590882bbd6 to your computer and use it in GitHub Desktop.
Inject jQuery into Selenium Driver
from selenium import webdriver
driver = webdriver.Firefox()
driver.get('https://www.facebook.com/')
with open('jquery-1.9.1.min.js', 'r') as jquery_js:
jquery = jquery_js.read() #read the jquery from a file
driver.execute_script(jquery) #active the jquery lib
driver.execute_script("$('#email').text('anhld')")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment