Skip to content

Commit

Permalink
add additional click in clickbox method.
Browse files Browse the repository at this point in the history
  • Loading branch information
renanllisboa committed Aug 6, 2021
1 parent fe445db commit b16306d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
2 changes: 1 addition & 1 deletion scripts/install_package.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ taskkill /f /im chromedriver.exe
echo -------------------------
echo Installing project...
echo -------------------------
pip install -U dist/tir_framework-1.18.0rc3.tar.gz
pip install -U dist/tir_framework-1.18.0rc4.tar.gz
pause >nul | set/p = Press any key to exit ...
33 changes: 29 additions & 4 deletions tir/technologies/webapp_internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -3397,7 +3397,7 @@ def click_box_dataframe(self, first_column=None, second_column=None, first_conte
elif first_column and first_content:
first_column_values = df[first_column].values
first_column_formatted_values = list(map(lambda x: x.replace(' ', ''), first_column_values))
content = next(iter(list(filter(lambda x: x == first_content, first_column_formatted_values))), None)
content = next(iter(list(filter(lambda x: x == first_content.replace(' ', ''), first_column_formatted_values))), None)
if content:
index_number.append(first_column_formatted_values.index(content))
if len(index_number) > 0:
Expand Down Expand Up @@ -3428,10 +3428,35 @@ def click_box_dataframe(self, first_column=None, second_column=None, first_conte
for index in index_number:
element_bs4 = next(iter(tr[index].select('td')))
self.wait_blocker()
self.performing_click(element_bs4, class_grid)
self.performing_additional_click(element_bs4, tr, index, class_grid, grid_number)
else:
element = lambda: self.soup_to_selenium(next(iter(tr[index_number].select('td'))))
self.performing_click(element, class_grid)
index = index_number
element_bs4 = next(iter(tr[index].select('td')))
self.wait_blocker()
self.performing_additional_click(element_bs4, tr, index, class_grid, grid_number)

def performing_additional_click(self, element_bs4, tr, index, class_grid, grid_number):

if element_bs4:
success = False
td = next(iter(tr[index].select('td')))

if hasattr(td, 'style'):

last_box_state = td.attrs['style']

endtime = time.time() + self.config.time_out
while time.time() < endtime and not success:
self.performing_click(element_bs4, class_grid)
self.wait_blocker()
time.sleep(2)
grid = self.get_grid(grid_number=grid_number)
tr = grid.select('tbody > tr')
td = next(iter(tr[index].select('td')))
new_box_state = td.attrs['style']
success = last_box_state != new_box_state
else:
logger().debug(f"Couldn't check box element td: {str(td)}")

def grid_dataframe(self, grid_number=0):

Expand Down
2 changes: 1 addition & 1 deletion tir/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.18.0rc3'
__version__ = '1.18.0rc4'

0 comments on commit b16306d

Please sign in to comment.