From 160bbf8372aba8aa61167ece60ea796cb9cb07bd Mon Sep 17 00:00:00 2001 From: Somdev Sangwan Date: Sat, 8 Jun 2019 16:18:31 +0530 Subject: [PATCH] dropping browser validation temporarily --- core/browserEngine.py | 70 ------------------------------------------- 1 file changed, 70 deletions(-) delete mode 100644 core/browserEngine.py diff --git a/core/browserEngine.py b/core/browserEngine.py deleted file mode 100644 index 6518c51b..00000000 --- a/core/browserEngine.py +++ /dev/null @@ -1,70 +0,0 @@ -import re -import os -import sys - -from core.utils import writer -from selenium import webdriver -from selenium.webdriver.firefox.options import Options -from selenium.common.exceptions import UnexpectedAlertPresentException, NoAlertPresentException - - -def init_browser(): - global browser - options = Options() - # options.add_argument('--headless') - browser = webdriver.Firefox(options=options) - - -def kill_browser(): - global browser - if browser is not None: - browser.quit() - - -def is_alert_present(): - global browser - try: - print(browser.switch_to.alert.text) - browser.switch_to.alert.dismiss() - return True - except NoAlertPresentException: - return False - except UnexpectedAlertPresentException: - return True - except Exception as e: - print(e) - - -def browser_engine(response): - global browser - _write_response_to_file(response) - navigate_to('file://' + sys.path[0] + '/test.html') - os.remove('test.html') - popUp = False - actions = webdriver.ActionChains(browser) - - try: - actions.move_by_offset(2, 2) - actions.move_by_offset(-2, -2) - actions.perform() - if is_alert_present(): - popUp = True - - except UnexpectedAlertPresentException: - popUp = True - except Exception as e: - print(e) - return popUp - - -def _write_response_to_file(response): - response = re.sub(r'', '