make the browser static so we don't have to initialize it each execution.

This commit is contained in:
Devin Stokes
2019-04-30 17:52:44 -07:00
parent 0c66cd94cb
commit dada14f3e8

View File

@@ -1,18 +1,17 @@
import re
import os
import sys
from core.config import xsschecker
from core.utils import writer
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from selenium.common.exceptions import UnexpectedAlertPresentException
from selenium.webdriver.support import expected_conditions as EC
options = Options()
options.add_argument('--headless')
browser = webdriver.Firefox(options=options)
def browserEngine(response):
options = Options()
options.add_argument('--headless')
browser = webdriver.Firefox(options=options)
response = re.sub(r'<script.*?src=.*?>', '<script src=#>', response, re.I)
response = re.sub(r'href=.*?>', 'href=#>', response, re.I)
writer(response, 'test.html')
@@ -28,7 +27,6 @@ def browserEngine(response):
popUp = True
browser.quit()
except UnexpectedAlertPresentException:
popUp = True
browser.quit()