Skip to content

Commit

Permalink
rething chrome input
Browse files Browse the repository at this point in the history
  • Loading branch information
98llm committed Dec 31, 2024
1 parent a63d9fc commit 796fb84
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
23 changes: 5 additions & 18 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, send_type=1):
def send_keys(self, element, arg):
"""
[Internal]
Expand All @@ -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:
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tir/technologies/webapp_internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 796fb84

Please sign in to comment.