Skip to content

Commit

Permalink
Merge pull request #1381 from totvs/feature/replace_slash
Browse files Browse the repository at this point in the history
added replace slash
  • Loading branch information
renanllisboa authored Jan 8, 2024
2 parents 3a7f144 + 7fbf0cd commit 96a3bf4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tir/technologies/webapp_internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -7469,7 +7469,7 @@ def SetFilePath(self, value, button = ""):
if element:
self.driver.execute_script("document.querySelector('wa-file-picker').shadowRoot.querySelector('#{}').value='';".format(element.get_attribute("id")))

self.send_keys(element, value)
self.send_keys(element, self.replace_slash(value))
elements = self.driver.execute_script(f"return arguments[0].shadowRoot.querySelectorAll('button')", self.soup_to_selenium(containers_soup))
possible_buttons = button.upper() + '_' + self.language.open.upper() + '_' + self.language.save.upper()
elements = list(filter(lambda x: x.text.strip().upper() in possible_buttons, elements ))
Expand All @@ -7479,7 +7479,7 @@ def SetFilePath(self, value, button = ""):

if element:
self.driver.execute_script("document.querySelector('#{}').value='';".format(element.get_attribute("id")))
self.send_keys(element, value)
self.send_keys(element, self.replace_slash(value))
elements = self.driver.find_elements(By.CSS_SELECTOR, ".tremoteopensave button")

if elements:
Expand All @@ -7497,6 +7497,14 @@ def SetFilePath(self, value, button = ""):

self.log_error(f"Button: {button} not found")

def replace_slash(self, path):

slash = r"/" if (sys.platform.lower() == "linux") else r"\\"

pattern = re.compile(r'[\/\\]')

if pattern.findall(path):
return pattern.sub(slash, path)

def MessageBoxClick(self, button_text):
"""
Expand Down

0 comments on commit 96a3bf4

Please sign in to comment.