diff --git a/palladium/chrome_custom.py b/palladium/chrome_custom.py index b232d4f..0873045 100644 --- a/palladium/chrome_custom.py +++ b/palladium/chrome_custom.py @@ -11,10 +11,15 @@ class ChromeCustom(Chrome): - logs_dir = os.path.join('.', 'logs') - def __init__(self, headless=True, logs_dir=None): + def __init__( + self, + headless=True, + logs_dir=None, + log_error=False + ): self.logs_dir = os.path.join(os.getcwd() if logs_dir is None else logs_dir, 'logs') + self.log_error = log_error chrome_options = ChromeOptions() @@ -61,9 +66,10 @@ def attempt( except Exception as exp: time.sleep(wait_time) if i + 1 == total_attempts: - logging.exception(exp) - name = ''.join([str(i) for i in [random.randint(0, 9) for j in range(12)]]) - self.get_screenshot_as_file(os.path.join(self.logs_dir, f'screenshot_{name}.png')) + if self.log_error: + logging.exception(exp) + name = ''.join([str(i) for i in [random.randint(0, 9) for j in range(12)]]) + self.get_screenshot_as_file(os.path.join(self.logs_dir, f'screenshot_{name}.png')) raise Exception(f'Attempt failed for method. {method}') def highlight(self, element, color='red', border=5, effect_time=5): diff --git a/requirements.txt b/requirements.txt index 49548b4..070ac34 100644 --- a/requirements.txt +++ b/requirements.txt @@ -21,6 +21,6 @@ six==1.15.0 tqdm==4.48.2 twine==3.2.0 urllib3==1.25.10 -viper-python==0.1.1 +viper-python==0.1.3 webencodings==0.5.1 zipp==3.1.0 diff --git a/setup.py b/setup.py index 8e1a652..3b35848 100644 --- a/setup.py +++ b/setup.py @@ -8,13 +8,13 @@ setup( name='palladium-python', packages=['palladium'], - version='0.1.2', + version='0.1.3', license='MIT', description='Common utility functions.', author='Siddhant Kushwaha', author_email='k16.siddhant@gmail.com', url='https://github.com/siddhantkushwaha/palladium', - download_url='https://github.com/siddhantkushwaha/palladium/archive/0.1.2.tar.gz', + download_url='https://github.com/siddhantkushwaha/palladium/archive/0.1.3.tar.gz', keywords=['CHROMIUM', 'SELENIUM', 'AUTOMATION', 'TESTING'], install_requires=[ 'requests',