Skip to content

Instantly share code, notes, and snippets.

@u6tory
Forked from anhldbk/Selenium.Python.InjectJS.py
Last active March 7, 2021 04:49
Show Gist options
  • Select an option

  • Save u6tory/4ce3ac75ad01c69f10abe7126400fc53 to your computer and use it in GitHub Desktop.

Select an option

Save u6tory/4ce3ac75ad01c69f10abe7126400fc53 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')")
@u6tory
Copy link
Copy Markdown
Author

u6tory commented May 31, 2020

good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment