Skip to content

Commit

Permalink
fix(table): update element finding function (#421)
Browse files Browse the repository at this point in the history
Updated using of `find_element` to `find_elements` to avoid the
`NoSuchElementException` when the element isn't found in the page.
  • Loading branch information
hetangmodi-crest authored May 10, 2024
1 parent cb06628 commit 90a9960
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions pytest_splunk_addon_ui_smartx/components/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,13 +312,27 @@ def get_list_of_actions(self, name):
"""
value_list = []
_row = self._get_row(name)
if _row.find_element(*list(self.elements["edit"]._asdict().values())) != None:
# use `find_elements` over `find_element` to avoid NoSuchElementException exception when
# the action isn't present + to verify only 1 icon of the action is present
if (
len(_row.find_elements(*list(self.elements["edit"]._asdict().values())))
== 1
):
value_list.append("Edit")
if _row.find_element(*list(self.elements["clone"]._asdict().values())) != None:
if (
len(_row.find_elements(*list(self.elements["clone"]._asdict().values())))
== 1
):
value_list.append("Clone")
if _row.find_element(*list(self.elements["search"]._asdict().values())) != None:
if (
len(_row.find_elements(*list(self.elements["search"]._asdict().values())))
== 1
):
value_list.append("Search")
if _row.find_element(*list(self.elements["delete"]._asdict().values())) != None:
if (
len(_row.find_elements(*list(self.elements["delete"]._asdict().values())))
== 1
):
value_list.append("Delete")

return value_list
Expand Down

0 comments on commit 90a9960

Please sign in to comment.