@@ -1748,8 +1748,16 @@ def Keystroke_For_Element(data_set):
17481748 # Insert keystroke
17491749 try :
17501750 if stype == "keys" :
1751- # Requires: python-selenium v3.1+, geckodriver v0.15.0+
1752- keystroke_value = keystroke_value .upper ().replace ("CTRL" , "CONTROL" )
1751+ keystroke_value = keystroke_value .upper ()
1752+ convert = {
1753+ "CTRL" : "CONTROL" ,
1754+ "PLUS" : "ADD" ,
1755+ "MINUS" : "SUBTRACT" ,
1756+ "DASH" : "SUBTRACT" ,
1757+ "CMD" : "COMMAND" ,
1758+ }
1759+ for key in convert :
1760+ keystroke_value = keystroke_value .replace (key , convert [key ])
17531761 if "+" in keystroke_value :
17541762 hotkey_list = keystroke_value .split ("+" )
17551763 for i in range (len (hotkey_list )):
@@ -3197,11 +3205,15 @@ def scroll_to_element(step_data):
31973205 sModuleInfo = inspect .currentframe ().f_code .co_name + " : " + MODULE_NAME
31983206 global selenium_driver
31993207 use_js = False
3208+ additional_scroll = 0.1
32003209 try :
3201- for row in step_data :
3210+ for left , mid , right in step_data :
3211+ left = left .lower ().strip ()
3212+ if "use js" == left :
3213+ use_js = right .strip ().lower () in ("true" , "yes" , "1" )
3214+ elif "additional scroll" == left :
3215+ additional_scroll = float (right .strip ())
32023216
3203- if "use js" in row [0 ].lower ():
3204- use_js = row [2 ].strip ().lower () in ("true" , "yes" , "1" )
32053217 scroll_element = LocateElement .Get_Element (step_data , selenium_driver )
32063218 if scroll_element in failed_tag_list :
32073219 CommonUtil .ExecLog (
@@ -3217,10 +3229,10 @@ def scroll_to_element(step_data):
32173229 if use_js :
32183230 selenium_driver .execute_script ("arguments[0].scrollIntoView(true);" , scroll_element )
32193231 else :
3220- actions = ActionChains (selenium_driver )
3221-
3222- actions . move_to_element ( scroll_element )
3223- actions . perform ( )
3232+ ActionChains (selenium_driver ). move_to_element ( scroll_element ). perform ( )
3233+
3234+ if additional_scroll > 0 :
3235+ selenium_driver . execute_script ( f"window.scrollBy(0, { round ( selenium_driver . get_window_size ()[ 'height' ] * additional_scroll ) } )" )
32243236 return "passed"
32253237
32263238 except Exception :
0 commit comments