To execute Javascript in python, use execute_script("javascript script here")
.
execute_script is called on a webdriver instance, and can be any valid javascript.
from selenium import webdriver
driver = webdriver.Chrome()
driver.execute_script("alert('running javascript');")