Create a new element by selenium dynamically
问题 What I need is to add a script tag to the head of html document. I am using the code below but when I view page source, the script is not there. Thank you in advance, driver = webdriver.Chrome() driver.get("http://www.x.org") execu = ''' var scr = document.createElement('script'); scr.type = 'text/javascript'; scr.text = `let calls = (function(){ let calls = 0; let fun = document.createElement; document.createElement = function(){ calls++; return fun.apply(document, arguments); } return ()=