From bef138e4a8254968454ff06b45e47face0940863 Mon Sep 17 00:00:00 2001 From: ekultek Date: Fri, 13 Oct 2017 10:10:20 -0500 Subject: [PATCH] patch for an issue where there HTML could not be parsed due to fake div classes (issue #91) --- lib/core/settings.py | 2 +- var/google_search/search.py | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/core/settings.py b/lib/core/settings.py index 220d538..edbef51 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -22,7 +22,7 @@ except NameError: # clone link CLONE = "https://github.com/ekultek/zeus-scanner.git" # current version -VERSION = "1.0.42.6ad5" +VERSION = "1.0.44.f2a0" # colors to output depending on the version VERSION_TYPE_COLORS = {"dev": 33, "stable": 92, "other": 30} # version string formatting diff --git a/var/google_search/search.py b/var/google_search/search.py index 9cebfba..ef07adb 100644 --- a/var/google_search/search.py +++ b/var/google_search/search.py @@ -17,7 +17,10 @@ from selenium import webdriver from pyvirtualdisplay import Display from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.proxy import * -from selenium.webdriver.remote.errorhandler import UnexpectedAlertPresentException +from selenium.webdriver.remote.errorhandler import ( + UnexpectedAlertPresentException, + ElementNotInteractableException +) from var.auto_issue.github import request_issue_creation from lib.core.settings import ( @@ -134,9 +137,15 @@ def get_urls(query, url, verbose=False, warning=True, **kwargs): logger.info(set_color( "searching '{}' using query '{}'...".format(url, query) )) - search.send_keys(query) - search.send_keys(Keys.RETURN) # hit return after you enter search text - time.sleep(3) + try: + search.send_keys(query) + search.send_keys(Keys.RETURN) # hit return after you enter search text + time.sleep(3) + except ElementNotInteractableException: + browser.execute_script("document.querySelectorAll('label.boxed')[1].click()") + search.send_keys(query) + search.send_keys(Keys.RETURN) # hit return after you enter search text + time.sleep(3) if verbose: logger.debug(set_color( "obtaining URL from selenium..."