import sys
link = sys.argv[1]
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
options = Options()
options.headless = True
driver = webdriver.Firefox(options=options, executable_path=r'/usr/bin/geckodriver')
driver.get(link)
s = driver.page_source
print((s.encode("utf-8")))
driver.quit()
This is my code using python firefox and selenium, it works fine at the beginning in my server but then this script made some errors on my server because of lack memory. System admins say that my script does not close tabs, I put in my script this part:
driver.quit()
but it does seem it's not working, how should i close tabs then?