Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix/chrome input date #1625

Merged
merged 3 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions tir/technologies/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ def return_selected_combo_value(self, element):
else:
return ''

def send_keys(self, element, arg):
def send_keys(self, element, arg, send_type=1):
"""
[Internal]

Expand All @@ -898,7 +898,8 @@ def send_keys(self, element, arg):
: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:
Expand All @@ -909,10 +910,21 @@ def send_keys(self, element, arg):
>>> self.send_keys(element(), Keys.ENTER)
"""
try:
if arg.isprintable():
element.clear()
element.send_keys(Keys.CONTROL, 'a')
element.send_keys(arg)
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()

except Exception:
actions = ActionChains(self.driver)
actions.move_to_element(element)
Expand Down
7 changes: 6 additions & 1 deletion tir/technologies/webapp_internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,12 @@ def filling_date(self, shadow_root=None, container=None):
ActionChains(self.driver).key_down(Keys.CONTROL).send_keys(Keys.HOME).key_up(Keys.CONTROL).perform()
ActionChains(self.driver).key_down(Keys.CONTROL).key_down(Keys.SHIFT).send_keys(
Keys.END).key_up(Keys.CONTROL).key_up(Keys.SHIFT).perform()
self.send_keys(date(), self.config.date)

if self.config.browser.lower() == "chrome":
self.send_keys(date(), self.config.date, send_type=2)
else:
self.send_keys(date(), self.config.date)

base_date_value = self.merge_date_mask(self.config.date, self.get_web_value(date()))
if self.config.poui_login:
ActionChains(self.driver).send_keys(Keys.TAB * 2).perform()
Expand Down
Loading