@@ -64,37 +64,6 @@ 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 = {
@@ -111,6 +80,15 @@ def get_element_properties(driver, child):
11180 return child_properties
11281
11382
83+ def get_elements_with_properties (driver , elem_properties , children ):
84+ elems_with_same_properties = []
85+ for child in children :
86+ child_properties = get_element_properties (driver , child )
87+ if child_properties == elem_properties :
88+ elems_with_same_properties .append (child )
89+ return elems_with_same_properties
90+
91+
11492def was_visited (current_path , visited_paths , elem_properties ):
11593 current_path_elements = [element for element , _ , _ in current_path ]
11694 current_path_elements .append (elem_properties )
0 commit comments