Skip to content

Commit 90a9960

Browse files
fix(table): update element finding function (#421)
Updated using of `find_element` to `find_elements` to avoid the `NoSuchElementException` when the element isn't found in the page.
1 parent cb06628 commit 90a9960

File tree

1 file changed

+18
-4
lines changed
  • pytest_splunk_addon_ui_smartx/components

1 file changed

+18
-4
lines changed

pytest_splunk_addon_ui_smartx/components/table.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,13 +312,27 @@ def get_list_of_actions(self, name):
312312
"""
313313
value_list = []
314314
_row = self._get_row(name)
315-
if _row.find_element(*list(self.elements["edit"]._asdict().values())) != None:
315+
# use `find_elements` over `find_element` to avoid NoSuchElementException exception when
316+
# the action isn't present + to verify only 1 icon of the action is present
317+
if (
318+
len(_row.find_elements(*list(self.elements["edit"]._asdict().values())))
319+
== 1
320+
):
316321
value_list.append("Edit")
317-
if _row.find_element(*list(self.elements["clone"]._asdict().values())) != None:
322+
if (
323+
len(_row.find_elements(*list(self.elements["clone"]._asdict().values())))
324+
== 1
325+
):
318326
value_list.append("Clone")
319-
if _row.find_element(*list(self.elements["search"]._asdict().values())) != None:
327+
if (
328+
len(_row.find_elements(*list(self.elements["search"]._asdict().values())))
329+
== 1
330+
):
320331
value_list.append("Search")
321-
if _row.find_element(*list(self.elements["delete"]._asdict().values())) != None:
332+
if (
333+
len(_row.find_elements(*list(self.elements["delete"]._asdict().values())))
334+
== 1
335+
):
322336
value_list.append("Delete")
323337

324338
return value_list

0 commit comments

Comments
 (0)