From bc2531690e4e0907afd00a116521a23529304171 Mon Sep 17 00:00:00 2001 From: suellenz <35066873+suellenz@users.noreply.github.com> Date: Mon, 23 Jul 2018 11:54:59 -0300 Subject: [PATCH 01/20] Change log color (#11) * changed color of message to magenta in order to work in Jenkins --- parakeet/__version__.py | 2 +- parakeet/lettuce_logger.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/parakeet/__version__.py b/parakeet/__version__.py index 4b94f8f..a9e0878 100644 --- a/parakeet/__version__.py +++ b/parakeet/__version__.py @@ -5,4 +5,4 @@ # |_| \__,_|_| \__,_|_|\_\___|\___|\__| -__version__ = '0.0.14' +__version__ = '0.0.15' diff --git a/parakeet/lettuce_logger.py b/parakeet/lettuce_logger.py index d7e56c6..9418b84 100644 --- a/parakeet/lettuce_logger.py +++ b/parakeet/lettuce_logger.py @@ -15,7 +15,7 @@ formatter = ColoredFormatter( "%(green)s%(asctime)s - %(name)s -%(reset)s %(log_color)s%(levelname)-8s%(reset)s" - " - %(white)s%(message)s", + " - %(purple)s%(message)s", datefmt=None, reset=True, log_colors={ From 7c8a07f0e954e94ea329d34297618133e1d6dfc8 Mon Sep 17 00:00:00 2001 From: Ramon Mendes de Souza Date: Wed, 25 Jul 2018 12:15:14 -0300 Subject: [PATCH 02/20] Add parameter waiting time on parakeet --- parakeet/browser.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/parakeet/browser.py b/parakeet/browser.py index 2740093..12494be 100644 --- a/parakeet/browser.py +++ b/parakeet/browser.py @@ -167,10 +167,11 @@ def is_element_present_by_id(self, element_id): .format(element_id)) return self.splinter.is_element_present_by_id(element_id, self.waiting_time) - def is_element_present_by_xpath(self, element_xpath): - LOG.debug('is_element_present_by_xpath({})' - .format(element_xpath)) - return self.splinter.is_element_present_by_xpath(element_xpath, self.waiting_time) + def is_element_present_by_xpath(self, element_xpath, p_waiting_time): + _waiting_time = p_waiting_time if p_waiting_time else self.waiting_time + LOG.debug('is_element_present_by_xpath({}, {})' + .format(element_xpath, _waiting_time)) + return self.splinter.is_element_present_by_xpath(element_xpath, _waiting_time) def is_text_present(self, text): LOG.debug('is_text_present({})' From c6928390b10a2afe047ea16021762a7afbc549cf Mon Sep 17 00:00:00 2001 From: Ramon Mendes de Souza Date: Wed, 25 Jul 2018 13:01:33 -0300 Subject: [PATCH 03/20] Fix default parameter --- parakeet/browser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parakeet/browser.py b/parakeet/browser.py index 12494be..f7f95af 100644 --- a/parakeet/browser.py +++ b/parakeet/browser.py @@ -167,7 +167,7 @@ def is_element_present_by_id(self, element_id): .format(element_id)) return self.splinter.is_element_present_by_id(element_id, self.waiting_time) - def is_element_present_by_xpath(self, element_xpath, p_waiting_time): + def is_element_present_by_xpath(self, element_xpath, p_waiting_time=None): _waiting_time = p_waiting_time if p_waiting_time else self.waiting_time LOG.debug('is_element_present_by_xpath({}, {})' .format(element_xpath, _waiting_time)) From 66924f6640e66a12a13b13532b27f2efe320270b Mon Sep 17 00:00:00 2001 From: Ramon Mendes de Souza Date: Wed, 25 Jul 2018 13:08:45 -0300 Subject: [PATCH 04/20] Change the exception message --- parakeet/browser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parakeet/browser.py b/parakeet/browser.py index f7f95af..f6af10b 100644 --- a/parakeet/browser.py +++ b/parakeet/browser.py @@ -231,7 +231,7 @@ def retry(self, method=None, **kwargs): return result except Exception as ex: - LOG.error('Exception: {}'.format(ex.message)) + LOG.error('Exception: {}'.format(str(ex))) if _next_iterator < _retry: return self._perform_method(_next, _next_iterator, kwargs, method) self.selenium.save_screenshot('parakeet_error_{:05d}_{}.png' From 39c20baae9a0d8fdd9087ab201cb4a3b96ec91b5 Mon Sep 17 00:00:00 2001 From: Ramon Mendes de Souza Date: Wed, 25 Jul 2018 16:25:35 -0300 Subject: [PATCH 05/20] Fix backdrop problem --- parakeet/browser.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/parakeet/browser.py b/parakeet/browser.py index f6af10b..8868a53 100644 --- a/parakeet/browser.py +++ b/parakeet/browser.py @@ -232,12 +232,19 @@ def retry(self, method=None, **kwargs): return result except Exception as ex: LOG.error('Exception: {}'.format(str(ex))) + if 'md-backdrop' in str(ex): + self._remove_back_drop() + if _next_iterator < _retry: return self._perform_method(_next, _next_iterator, kwargs, method) self.selenium.save_screenshot('parakeet_error_{:05d}_{}.png' .format(next_image(), method.__name__)) raise ex + def _remove_back_drop(self): + LOG.info('---- Remove md-backdrop ---') + self.splinter.execute_script("document.getElementsByTagName('md-backdrop')[0].style.display = 'none'") + def _perform_method(self, next, next_iterator, kwargs, method): """ Perform the method and return the value From a02e6ef640e294f7aaffbb3474d7a4040ccecc71 Mon Sep 17 00:00:00 2001 From: Ramon Mendes de Souza Date: Thu, 26 Jul 2018 11:17:13 -0300 Subject: [PATCH 06/20] Fix md scrool problem --- parakeet/browser.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/parakeet/browser.py b/parakeet/browser.py index 8868a53..a3cfe4d 100644 --- a/parakeet/browser.py +++ b/parakeet/browser.py @@ -34,10 +34,14 @@ def clear(self): return self def click(self): - self.parakeet.retry(method=self.click_once_time_only) + try: + self.parakeet.retry(method=self.click_once) + except Exception as ex: + LOG.error('Attempts exceeded') + return self - def click_once_time_only(self): + def click_once(self): self.element = self.wait_element_to_be_clickable() self.element.click() return self @@ -235,12 +239,19 @@ def retry(self, method=None, **kwargs): if 'md-backdrop' in str(ex): self._remove_back_drop() + if 'md-scroll-mask' in str(ex): + self._remove_scroll_back() + if _next_iterator < _retry: return self._perform_method(_next, _next_iterator, kwargs, method) self.selenium.save_screenshot('parakeet_error_{:05d}_{}.png' .format(next_image(), method.__name__)) raise ex + def _remove_scroll_back(self): + LOG.info('---- Remove md-scroll-mask ---') + self.splinter.execute_script("document.getElementsByClassName('md-scroll-mask')[0]['style']['display'] = 'none'") + def _remove_back_drop(self): LOG.info('---- Remove md-backdrop ---') self.splinter.execute_script("document.getElementsByTagName('md-backdrop')[0].style.display = 'none'") From 470a4ef7edce9074b671cbe65a66c49dcd61f573 Mon Sep 17 00:00:00 2001 From: Ramon Mendes de Souza Date: Thu, 26 Jul 2018 17:30:01 -0300 Subject: [PATCH 07/20] Add more information on log --- parakeet/lettuce_logger.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/parakeet/lettuce_logger.py b/parakeet/lettuce_logger.py index 9418b84..e9ea7a1 100644 --- a/parakeet/lettuce_logger.py +++ b/parakeet/lettuce_logger.py @@ -14,8 +14,8 @@ SNAPSHOT_DEBUG = 'SNAPSHOT_DEBUG' formatter = ColoredFormatter( - "%(green)s%(asctime)s - %(name)s -%(reset)s %(log_color)s%(levelname)-8s%(reset)s" - " - %(purple)s%(message)s", + "%(bold_blue)s[%(processName)s]%(reset)s %(green)s%(asctime)s - %(name)s -%(reset)s " + "%(log_color)s%(levelname)-8s%(reset)s - %(purple)s%(message)s", datefmt=None, reset=True, log_colors={ @@ -27,7 +27,6 @@ } ) - class CustomLogging(logging.getLoggerClass()): """ The ideia is override our custom logs and do some additional stuffs. From 29abd25cd6d063e4f02490a1c32fe68c822a1df7 Mon Sep 17 00:00:00 2001 From: Ramon Mendes de Souza Date: Fri, 27 Jul 2018 16:26:44 -0300 Subject: [PATCH 08/20] Fix problem with timeout --- parakeet/browser.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/parakeet/browser.py b/parakeet/browser.py index a3cfe4d..240d596 100644 --- a/parakeet/browser.py +++ b/parakeet/browser.py @@ -2,6 +2,8 @@ from __future__ import division import time import re + +from selenium.common.exceptions import TimeoutException from splinter import Browser from selenium import webdriver from selenium.webdriver.common.by import By @@ -198,9 +200,15 @@ def get_element_waiting_for_its_presence(self, locator, waiting_time=None): _waiting_time = waiting_time if waiting_time else self.waiting_time LOG.debug('get_element_waiting_for_its_presence({}, {}, {})' .format(locator, _waiting_time, self.poll_frequency)) - element = WebDriverWait(self.selenium, _waiting_time, self.poll_frequency).until( - ec.presence_of_element_located(locator) - ) + element = None + + try: + element = WebDriverWait(self.selenium, _waiting_time, self.poll_frequency).until( + ec.presence_of_element_located(locator) + ) + except TimeoutException: + LOG.error("Time is up! {}s".format(_waiting_time)) + return element def get_element_waiting_for_its_presence_by_xpath(self, xpath, waiting_time=None): From e1dc0d3fc66e174a1c4434c260d53c9217fcb10d Mon Sep 17 00:00:00 2001 From: Ramon Mendes de Souza Date: Wed, 1 Aug 2018 12:02:17 -0300 Subject: [PATCH 09/20] Add option to remove colors from log in e2e tests --- parakeet/browser.py | 1 + parakeet/lettuce_logger.py | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/parakeet/browser.py b/parakeet/browser.py index 240d596..1283845 100644 --- a/parakeet/browser.py +++ b/parakeet/browser.py @@ -148,6 +148,7 @@ def __init__(self, config): self.waiting_time = int(config.get('default_implicitly_wait_seconds')) self.poll_frequency = int(config.get('default_poll_frequency_seconds')) self.snapshot_debug = config.get('snapshot_debug', False) + self.color_log = config.get('color_log', False) self.type_pause = float(config.get('type_pause', 0)) self.retry_get_element = int(config.get('retry', 1)) self.selenium.implicitly_wait(self.waiting_time) diff --git a/parakeet/lettuce_logger.py b/parakeet/lettuce_logger.py index e9ea7a1..de63b97 100644 --- a/parakeet/lettuce_logger.py +++ b/parakeet/lettuce_logger.py @@ -13,7 +13,9 @@ APP_LOGGER = 'google.tests.e2e' SNAPSHOT_DEBUG = 'SNAPSHOT_DEBUG' -formatter = ColoredFormatter( +formatter_normal = logging.Formatter("[%(processName)s] %(asctime)s - %(name)s - %(levelname)-8s - %(message)s", + datefmt=None) +formatter_color = ColoredFormatter( "%(bold_blue)s[%(processName)s]%(reset)s %(green)s%(asctime)s - %(name)s -%(reset)s " "%(log_color)s%(levelname)-8s%(reset)s - %(purple)s%(message)s", datefmt=None, @@ -27,6 +29,7 @@ } ) + class CustomLogging(logging.getLoggerClass()): """ The ideia is override our custom logs and do some additional stuffs. @@ -38,7 +41,7 @@ def debug(self, msg, *args, **kwargs): return super(CustomLogging, self).debug(msg, *args, **kwargs) -def init_logs(level='INFO', logger=None): +def init_logs(level='INFO', logger=None, color_log=False): """ Setup the logs inside of the tests. :param level: @@ -50,7 +53,7 @@ def init_logs(level='INFO', logger=None): handler.setLevel(_level) ch = logging.StreamHandler(sys.stdout) ch.setLevel(_level) - ch.setFormatter(formatter) + ch.setFormatter(formatter_color if color_log else formatter_normal) handler.addHandler(ch) From b557ba1691cc7dd0fddf8b476c368e39572d9c49 Mon Sep 17 00:00:00 2001 From: Ramon Mendes de Souza Date: Wed, 1 Aug 2018 17:13:49 -0300 Subject: [PATCH 10/20] REQF-1366 add more save screenshot when error --- parakeet/browser.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/parakeet/browser.py b/parakeet/browser.py index 1283845..5d154d4 100644 --- a/parakeet/browser.py +++ b/parakeet/browser.py @@ -209,6 +209,9 @@ def get_element_waiting_for_its_presence(self, locator, waiting_time=None): ) except TimeoutException: LOG.error("Time is up! {}s".format(_waiting_time)) + self.selenium\ + .save_screenshot('parakeet_timeout_error_{:05d}.png' + .format(next_image())) return element @@ -253,6 +256,7 @@ def retry(self, method=None, **kwargs): if _next_iterator < _retry: return self._perform_method(_next, _next_iterator, kwargs, method) + self.selenium.save_screenshot('parakeet_error_{:05d}_{}.png' .format(next_image(), method.__name__)) raise ex From d87c447740780c29cd9f85833d70da3647a5c340 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amanda=20Magalh=C3=A3es?= Date: Mon, 20 Aug 2018 19:11:16 -0300 Subject: [PATCH 11/20] amandas file --- parakeet/common_steps.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parakeet/common_steps.py b/parakeet/common_steps.py index 479416d..c258c93 100644 --- a/parakeet/common_steps.py +++ b/parakeet/common_steps.py @@ -18,7 +18,7 @@ def login(step, user_name): google_oauth(user_name) elif world.cfg['login_provider'] == 'google_oauth_gapi2': google_oauth_gapi2(user_name) - LoginPage(world.browser, world.cfg['system_page_title']).redirect_to_home() + LoginPage(world.browser, world.cfg['system_page_title']).redirect_to_home() def google_oauth(user_name): From c5a868140d093754b02f806d7081d64dc30b9a3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amanda=20Magalh=C3=A3es?= Date: Thu, 30 Aug 2018 19:42:34 -0300 Subject: [PATCH 12/20] including functionality to click to log with a different account --- parakeet/auth.py | 12 +++++++++--- parakeet/common_steps.py | 4 ++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/parakeet/auth.py b/parakeet/auth.py index b0912e3..3dac3a6 100644 --- a/parakeet/auth.py +++ b/parakeet/auth.py @@ -62,9 +62,7 @@ def fill_password(self, password): def login(self): LOG.debug('login') - password_next_element = self.browser\ - .find_element_by_id('passwordNext')\ - .click() + self.browser.find_element_by_id('passwordNext').click() return self def redirect_to_home(self): @@ -95,3 +93,11 @@ def set_window(self): LOG.debug('set_window') self.window = self.browser.selenium.window_handles[0] return self + + def click_to_log_with_another_account(self): + LOG.debug('click_to_log_with_another_account') + element = '//*[@id="view_container"]/div/div/div[2]/div/div/div/form/content/section/div/content/div/div/ul/li[2]/div' + if self.browser.is_element_present_by_xpath(element): + LOG.debug('another account option is present, lets click on it') + self.browser.find_element_by_xpath(element).click() + return self diff --git a/parakeet/common_steps.py b/parakeet/common_steps.py index c258c93..02cf651 100644 --- a/parakeet/common_steps.py +++ b/parakeet/common_steps.py @@ -45,6 +45,10 @@ def google_oauth_gapi2(user_name): .set_window()\ .click_sign_in()\ .switch_windows_after() + #check if there is already an account signed in: + LoginPage(world.browser, world.cfg['system_page_title'])\ + .click_to_log_with_another_account() + google_oauth(user_name) LoginPage(world.browser, world.cfg['system_page_title'])\ .switch_windows_before() From 49fb5c8b3c6eac6dd812492a467ec02778249ce1 Mon Sep 17 00:00:00 2001 From: Lucas Borges Date: Fri, 14 Dec 2018 13:10:41 -0200 Subject: [PATCH 13/20] Changes selection of link account to a xpath pattern (#13) * Changes selection of link account to a xpath pattern * Bumps version to 0.0.16 --- parakeet/__version__.py | 2 +- parakeet/auth.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/parakeet/__version__.py b/parakeet/__version__.py index a9e0878..9d43a3d 100644 --- a/parakeet/__version__.py +++ b/parakeet/__version__.py @@ -5,4 +5,4 @@ # |_| \__,_|_| \__,_|_|\_\___|\___|\__| -__version__ = '0.0.15' +__version__ = '0.0.16' diff --git a/parakeet/auth.py b/parakeet/auth.py index b0912e3..0d47840 100644 --- a/parakeet/auth.py +++ b/parakeet/auth.py @@ -43,7 +43,7 @@ def fill_email(self, email): self.browser.find_element_by_id('identifierId').type(email) except TimeoutException: LOG.debug('click_on_identifier_before_fill_email') - self.browser.find_element_by_id('identifierLink').click() + self.browser.find_element_by_xpath('//ul/li[last()]/div[@role="link"]').click() self.browser.find_element_by_id('identifierId').type(email) return self @@ -62,7 +62,7 @@ def fill_password(self, password): def login(self): LOG.debug('login') - password_next_element = self.browser\ + self.browser\ .find_element_by_id('passwordNext')\ .click() return self From 777f78ca82735baca95d2f4eca1586ec5b654e21 Mon Sep 17 00:00:00 2001 From: Lucas Borges Date: Fri, 14 Dec 2018 15:35:59 -0200 Subject: [PATCH 14/20] Bumps version to 0.0.17, related to custom color logs --- parakeet/__version__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parakeet/__version__.py b/parakeet/__version__.py index 9d43a3d..78430b6 100644 --- a/parakeet/__version__.py +++ b/parakeet/__version__.py @@ -5,4 +5,4 @@ # |_| \__,_|_| \__,_|_|\_\___|\___|\__| -__version__ = '0.0.16' +__version__ = '0.0.17' From 526cffc804d9cb4bfe2339e5f6acc8e406023432 Mon Sep 17 00:00:00 2001 From: Lucas Borges Date: Fri, 14 Dec 2018 16:56:35 -0200 Subject: [PATCH 15/20] Adds sleep time to avoid blank popup page --- parakeet/auth.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/parakeet/auth.py b/parakeet/auth.py index 71a8459..2834471 100644 --- a/parakeet/auth.py +++ b/parakeet/auth.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -import base64 +import base64, time from selenium.common.exceptions import TimeoutException from selenium.webdriver.common.by import By @@ -76,6 +76,7 @@ def redirect_to_home(self): def click_sign_in(self): LOG.debug('click_sign_in') self.browser.find_element_by_xpath('//md-card-actions/button').click() + time.sleep(1) return self def switch_windows_before(self): From 1079290f1d0683c5d48ef862e6d2e7e2d6ea2e19 Mon Sep 17 00:00:00 2001 From: Lucas Borges Date: Fri, 14 Dec 2018 17:19:10 -0200 Subject: [PATCH 16/20] Comments possible break in login flow --- parakeet/common_steps.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/parakeet/common_steps.py b/parakeet/common_steps.py index 02cf651..6736d6b 100644 --- a/parakeet/common_steps.py +++ b/parakeet/common_steps.py @@ -46,8 +46,8 @@ def google_oauth_gapi2(user_name): .click_sign_in()\ .switch_windows_after() #check if there is already an account signed in: - LoginPage(world.browser, world.cfg['system_page_title'])\ - .click_to_log_with_another_account() + #LoginPage(world.browser, world.cfg['system_page_title'])\ + #.click_to_log_with_another_account() google_oauth(user_name) LoginPage(world.browser, world.cfg['system_page_title'])\ From 51a83b466d32bb13592de1487f45b57e0f710762 Mon Sep 17 00:00:00 2001 From: Lucas Borges Date: Mon, 17 Dec 2018 11:58:33 -0200 Subject: [PATCH 17/20] Adjusts logs criticity. --- parakeet/browser.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/parakeet/browser.py b/parakeet/browser.py index 5d154d4..e2b6d08 100644 --- a/parakeet/browser.py +++ b/parakeet/browser.py @@ -247,7 +247,7 @@ def retry(self, method=None, **kwargs): return result except Exception as ex: - LOG.error('Exception: {}'.format(str(ex))) + LOG.warn('Exception: {}'.format(str(ex))) if 'md-backdrop' in str(ex): self._remove_back_drop() @@ -259,6 +259,7 @@ def retry(self, method=None, **kwargs): self.selenium.save_screenshot('parakeet_error_{:05d}_{}.png' .format(next_image(), method.__name__)) + LOG.error('Exception: {}'.format(str(ex))) raise ex def _remove_scroll_back(self): From f8cc7fffa5d052a1930ac9cc32573a23fa9aec81 Mon Sep 17 00:00:00 2001 From: Lucas Borges Date: Mon, 17 Dec 2018 11:58:44 -0200 Subject: [PATCH 18/20] Removes commented code --- parakeet/common_steps.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/parakeet/common_steps.py b/parakeet/common_steps.py index 6736d6b..d4638cb 100644 --- a/parakeet/common_steps.py +++ b/parakeet/common_steps.py @@ -45,9 +45,6 @@ def google_oauth_gapi2(user_name): .set_window()\ .click_sign_in()\ .switch_windows_after() - #check if there is already an account signed in: - #LoginPage(world.browser, world.cfg['system_page_title'])\ - #.click_to_log_with_another_account() google_oauth(user_name) LoginPage(world.browser, world.cfg['system_page_title'])\ From cdc0a4b5c78f1b7a513d2058a8ce9ac2f7f08af2 Mon Sep 17 00:00:00 2001 From: Lucas Borges Date: Fri, 15 Mar 2019 18:01:44 -0300 Subject: [PATCH 19/20] Adds comment to explicit the time.sleep --- parakeet/auth.py | 8 -------- parakeet/browser.py | 7 +++---- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/parakeet/auth.py b/parakeet/auth.py index 2834471..4a804e7 100644 --- a/parakeet/auth.py +++ b/parakeet/auth.py @@ -94,11 +94,3 @@ def set_window(self): LOG.debug('set_window') self.window = self.browser.selenium.window_handles[0] return self - - def click_to_log_with_another_account(self): - LOG.debug('click_to_log_with_another_account') - element = '//*[@id="view_container"]/div/div/div[2]/div/div/div/form/content/section/div/content/div/div/ul/li[2]/div' - if self.browser.is_element_present_by_xpath(element): - LOG.debug('another account option is present, lets click on it') - self.browser.find_element_by_xpath(element).click() - return self diff --git a/parakeet/browser.py b/parakeet/browser.py index e2b6d08..a0d7776 100644 --- a/parakeet/browser.py +++ b/parakeet/browser.py @@ -174,11 +174,10 @@ def is_element_present_by_id(self, element_id): .format(element_id)) return self.splinter.is_element_present_by_id(element_id, self.waiting_time) - def is_element_present_by_xpath(self, element_xpath, p_waiting_time=None): - _waiting_time = p_waiting_time if p_waiting_time else self.waiting_time + def is_element_present_by_xpath(self, element_xpath): LOG.debug('is_element_present_by_xpath({}, {})' - .format(element_xpath, _waiting_time)) - return self.splinter.is_element_present_by_xpath(element_xpath, _waiting_time) + .format(element_xpath, element_xpath)) + return self.splinter.is_element_present_by_xpath(element_xpath, self.waiting_time) def is_text_present(self, text): LOG.debug('is_text_present({})' From ee1517317aaadfb4d5e1fb95f6c9cc630fbfa034 Mon Sep 17 00:00:00 2001 From: Lucas Borges Date: Mon, 18 Mar 2019 10:26:56 -0300 Subject: [PATCH 20/20] rollback xpath function interceptor changes --- parakeet/browser.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/parakeet/browser.py b/parakeet/browser.py index a0d7776..e2b6d08 100644 --- a/parakeet/browser.py +++ b/parakeet/browser.py @@ -174,10 +174,11 @@ def is_element_present_by_id(self, element_id): .format(element_id)) return self.splinter.is_element_present_by_id(element_id, self.waiting_time) - def is_element_present_by_xpath(self, element_xpath): + def is_element_present_by_xpath(self, element_xpath, p_waiting_time=None): + _waiting_time = p_waiting_time if p_waiting_time else self.waiting_time LOG.debug('is_element_present_by_xpath({}, {})' - .format(element_xpath, element_xpath)) - return self.splinter.is_element_present_by_xpath(element_xpath, self.waiting_time) + .format(element_xpath, _waiting_time)) + return self.splinter.is_element_present_by_xpath(element_xpath, _waiting_time) def is_text_present(self, text): LOG.debug('is_text_present({})'