Skip to content

Commit 6be4ab1

Browse files
Merge pull request #174 from AutomationSolutionz/Improve_locating
Improve locating
2 parents f84c1dd + 8c21dea commit 6be4ab1

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Framework/Built_In_Automation/Shared_Resources/LocateElement.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,14 @@ def Get_Element(step_data_set, driver, query_debug=False, return_all_elements=Fa
220220
if save_parameter != "": # save element to a variable
221221
sr.Set_Shared_Variables(save_parameter, result)
222222
return result # Return on pass
223+
elif result == "zeuz_failed":
224+
try:
225+
if len(generic_driver.find_elements(By.TAG_NAME, "iframe")) > 0:
226+
CommonUtil.ExecLog(sModuleInfo, "You have Iframes in your Webpage. Try switching Iframe with \"Switch Iframe\" action", 3)
227+
elif len(generic_driver.find_elements(By.TAG_NAME, "frame")) > 0:
228+
CommonUtil.ExecLog(sModuleInfo, "You have Frames in your Webpage. Try switching Frame with \"Switch Iframe\" action", 3)
229+
except:
230+
pass
223231
return "zeuz_failed"
224232
except Exception:
225233
return CommonUtil.Exception_Handler(sys.exc_info())
@@ -786,12 +794,12 @@ def _get_xpath_or_css_element(element_query, css_xpath,data_set, index_number=No
786794

787795
if all_matching_elements_visible_invisible and len(filter_elements(all_matching_elements_visible_invisible, "")) > 0:
788796
break
789-
elif time.time() > end:
797+
if time.time() > end:
790798
break
791799
# end of while loop
792800

793801
if exception_cnd:
794-
return False
802+
return "zeuz_failed"
795803

796804
if driver_type == "appium" and index_number is not None and index_number > 0 and len(all_matching_elements_visible_invisible) == 0:
797805
CommonUtil.ExecLog(sModuleInfo, "Element not found and we do not support Auto Scroll when index is provided", 2)
@@ -830,7 +838,7 @@ def _get_xpath_or_css_element(element_query, css_xpath,data_set, index_number=No
830838
"To get hidden elements add a row (\"allow hidden\", \"optional option\", \"yes\")",
831839
3
832840
)
833-
return False
841+
return "zeuz_failed"
834842
elif len(all_matching_elements) == 1 and index_number is None:
835843
if hidden_len > 0 and Filter != "allow hidden":
836844
CommonUtil.ExecLog(

0 commit comments

Comments
 (0)