Skip to content

Instantly share code, notes, and snippets.

@anhldbk
anhldbk / Selenium.Python.InjectJS.py
Last active April 15, 2023 03:53
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')")