From 796fb843b923e30370cb6c4f9ca6c9b848ac900c Mon Sep 17 00:00:00 2001 From: 98llm Date: Tue, 31 Dec 2024 09:09:09 -0300 Subject: [PATCH] rething chrome input --- tir/technologies/core/base.py | 23 +++++------------------ tir/technologies/webapp_internal.py | 2 +- 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/tir/technologies/core/base.py b/tir/technologies/core/base.py index 1fa43cd9..9fe414cf 100644 --- a/tir/technologies/core/base.py +++ b/tir/technologies/core/base.py @@ -888,7 +888,7 @@ def return_selected_combo_value(self, element): else: return '' - def send_keys(self, element, arg, send_type=1): + def send_keys(self, element, arg): """ [Internal] @@ -898,8 +898,6 @@ def send_keys(self, element, arg, send_type=1): :type element: Selenium object :param arg: Text or Keys to be sent to the element :type arg: str or selenium.webdriver.common.keys - :param send_type: Send Keys type can be do it Selenium or ActionChains - :type send_type: Int Usage: >>> #Defining the element: @@ -910,21 +908,10 @@ def send_keys(self, element, arg, send_type=1): >>> self.send_keys(element(), Keys.ENTER) """ try: - if send_type == 1: - if arg.isprintable(): - element.clear() - element.send_keys(Keys.CONTROL, 'a') - element.send_keys(arg) - elif send_type == 2: - actions = ActionChains(self.driver) - actions.move_to_element(element) - actions.click() - if arg.isprintable(): - actions.key_down(Keys.CONTROL).send_keys('a').key_up(Keys.CONTROL).send_keys(Keys.DELETE) - actions.send_keys(Keys.HOME) - actions.send_keys(arg) - actions.perform() - + if arg.isprintable(): + element.clear() + element.send_keys(Keys.CONTROL, 'a') + element.send_keys(arg) except Exception: actions = ActionChains(self.driver) actions.move_to_element(element) diff --git a/tir/technologies/webapp_internal.py b/tir/technologies/webapp_internal.py index 3219de9d..caebf73c 100644 --- a/tir/technologies/webapp_internal.py +++ b/tir/technologies/webapp_internal.py @@ -865,7 +865,7 @@ def filling_date(self, shadow_root=None, container=None): Keys.END).key_up(Keys.CONTROL).key_up(Keys.SHIFT).perform() if self.config.browser.lower() == "chrome": - self.send_keys(date(), self.config.date, send_type=2) + self.try_send_keys(date, self.config.date) else: self.send_keys(date(), self.config.date)