@@ -70,6 +70,7 @@ def __init__(self, browser, container, mapping=dict(), wait_for_seconds=10):
7070 ),
7171 "edit" : Selector (select = ".editBtn" ),
7272 "clone" : Selector (select = ".cloneBtn" ),
73+ "search" : Selector (select = ".searchBtn" ),
7374 "delete" : Selector (select = ".deleteBtn" ),
7475 "delete_prompt" : Selector (select = ".deletePrompt" ), # [data-test="body"]
7576 "delete_btn" : Selector (select = '[data-test="button"][label="Delete"]' ),
@@ -264,6 +265,8 @@ def get_table(self):
264265 table [row_name ][each_col ] = "Edit"
265266 if self .clone != None :
266267 table [row_name ][each_col ] += " | Clone"
268+ if self .search != None :
269+ table [row_name ][each_col ] += " | Search"
267270 if self .delete != None :
268271 table [row_name ][each_col ] += " | Delete"
269272 continue
@@ -313,6 +316,8 @@ def get_list_of_actions(self, name):
313316 value_list .append ("Edit" )
314317 if _row .find_element (* list (self .elements ["clone" ]._asdict ().values ())) != None :
315318 value_list .append ("Clone" )
319+ if _row .find_element (* list (self .elements ["search" ]._asdict ().values ())) != None :
320+ value_list .append ("Search" )
316321 if _row .find_element (* list (self .elements ["delete" ]._asdict ().values ())) != None :
317322 value_list .append ("Delete" )
318323
@@ -334,6 +339,14 @@ def clone_row(self, name):
334339 _row = self ._get_row (name )
335340 _row .find_element (* list (self .elements ["clone" ]._asdict ().values ())).click ()
336341
342+ def search_row_results (self , name ):
343+ """
344+ Search the results of the selected input. It will open the search and its results in a new tab.
345+ :param name: row_name of the table
346+ """
347+ _row = self ._get_row (name )
348+ _row .find_element (* list (self .elements ["search" ]._asdict ().values ())).click ()
349+
337350 def delete_row (self , name , cancel = False , close = False , prompt_msg = False ):
338351 """
339352 Delete the specified row. Clicking on delete will open a pop-up. Delete the row if neither of (cancel, close) specified.
@@ -547,3 +560,22 @@ def check_alert_sign(self, row_name, column_name="account"):
547560 return True
548561 except exceptions .NoSuchElementException :
549562 return False
563+
564+ def __getattr__ (self , key ):
565+ """
566+ Makes the web-elements to be accessible directly.
567+ - For example self.elements = {"textbox": Selector(by=..., select=...),
568+ Access the element by doing self.textbox directly.
569+ - It also has implicit wait while finding the element.
570+ :param key: The key of the element mentioned in self.elements
571+ :returns: The webelement we are accessing
572+ """
573+ # NOTE: Overriding the implementation for only table component.
574+ try :
575+ return self .get_element (key )
576+ except KeyError :
577+ raise
578+ except exceptions .TimeoutException :
579+ # in case when the element isn't found, return None
580+ # so that checks based on this class's properties are in sync.
581+ return None
0 commit comments