@@ -64,53 +64,33 @@ def wait_loaded(driver):
6464        print ('Continuing...' )
6565
6666
67- def  get_all_attributes (driver , child ):
68-     child_attributes  =  driver .execute_script (""" 
69-       let elem_attribute = {}; 
70- 
71-       for (let i = 0; i < arguments[0].attributes.length; i++) { 
72-         elem_attribute[arguments[0].attributes[i].name] = arguments[0].attributes[i].value; 
73-       } 
74-       return elem_attribute; 
75-     """ , child )
76- 
77-     return  child_attributes 
78- 
79- 
80- def  get_elements_with_attributes (driver , elem_attributes , children ):
81-     elems_with_same_attributes  =  []
82-     for  child  in  children :
83-         child_attributes  =  get_all_attributes (driver , child )
84-         if  child_attributes  ==  elem_attributes :
85-             elems_with_same_attributes .append (child )
86-     return  elems_with_same_attributes 
87- 
88- 
89- def  get_elements_with_properties (driver , elem_properties , children ):
90-     elems_with_same_properties  =  []
91-     for  child  in  children :
92-         child_properties  =  get_element_properties (driver , child )
93-         if  child_properties  ==  elem_properties :
94-             elems_with_same_properties .append (child )
95-     return  elems_with_same_properties 
96- 
97- 
9867def  get_element_properties (driver , child ):
9968    child_properties  =  driver .execute_script (""" 
10069      let elem_properties = { 
10170        tag: '', 
10271        attributes: {}, 
10372      }; 
73+ 
10474      for (let i = 0; i < arguments[0].attributes.length; i++) { 
10575        elem_properties.attributes[arguments[0].attributes[i].name] = arguments[0].attributes[i].value; 
10676      } 
10777      elem_properties.tag = arguments[0].tagName; 
78+ 
10879      return elem_properties; 
10980    """ , child )
11081
11182    return  child_properties 
11283
11384
85+ def  get_elements_with_properties (driver , elem_properties , children ):
86+     elems_with_same_properties  =  []
87+     for  child  in  children :
88+         child_properties  =  get_element_properties (driver , child )
89+         if  child_properties  ==  elem_properties :
90+             elems_with_same_properties .append (child )
91+     return  elems_with_same_properties 
92+ 
93+ 
11494def  was_visited (current_path , visited_paths , elem_properties ):
11595    current_path_elements  =  [element  for  element , _ , _  in  current_path ]
11696    current_path_elements .append (elem_properties )
0 commit comments