@@ -2730,16 +2730,15 @@ def save_attribute_values_in_list(step_data):
27302730                right  =  right .strip ()
27312731                if  "target parameter"  in  mid :
27322732                    target .append ([[], [], [], []])
2733-                     temp  =  right .strip ("," ).split ('" ,\n ' )
2733+                     temp  =  right .strip ("," ).split (',\n ' )
27342734                    data  =  []
2735-                     temp [- 1 ] =  temp [- 1 ][:- 1 ]
27362735                    for  each  in  temp :
2737-                         data .append (each .strip ().split ("=" ,1 ))
2736+                         data .append (each .strip ().split ("=" ,  1 ))
27382737                    for  i  in  range (len (data )):
27392738                        for  j  in  range (len (data [i ])):
27402739                            data [i ][j ] =  data [i ][j ].strip ()
27412740                            if  j  ==  1 :
2742-                                 data [i ][j ] =  data [i ][j ][ 1 :]    # dont add another strip here. dont need to strip inside quotation mark 
2741+                                 data [i ][j ] =  CommonUtil . strip1 ( data [i ][j ],  '"' )    # dont add another strip here. dont need to strip inside quotation mark 
27432742
27442743                    for  Left , Right  in  data :
27452744                        if  Left  ==  "return" :
@@ -3156,83 +3155,37 @@ def Sleep(step_data):
31563155def  Scroll (step_data ):
31573156    sModuleInfo  =  inspect .currentframe ().f_code .co_name  +  " : "  +  MODULE_NAME 
31583157    global  selenium_driver 
3159-     selenium_driver .switch_to .default_content ()
31603158    try :
3161-         scroll_inside_element  =  False 
3162-         scroll_window_name  =  "window" 
3163-         scroll_window  =  "" 
3164-         action_row  =  None 
3165- 
3166-         for  row  in  step_data :
3167-             if  str (row [1 ]) ==  "action" :
3168-                 action_row  =  row 
3169-                 break 
3170- 
3171-         if  not  action_row :
3172-             CommonUtil .ExecLog (sModuleInfo , "No action row defined" , 3 )
3173-             return  "zeuz_failed" 
3174- 
3175-         if  (
3176-                 len (step_data ) >  1 
3177-         ):  # element given scroll inside element, not on full window 
3178-             scroll_inside_element  =  True 
3179-             scroll_window_name  =  "arguments[0]" 
3180- 
3181-         if  scroll_inside_element :
3182-             scroll_window  =  LocateElement .Get_Element (step_data , selenium_driver )
3183-             if  scroll_window  in  failed_tag_list :
3184-                 CommonUtil .ExecLog (
3185-                     sModuleInfo ,
3186-                     "Element through which instructed to scroll not found" ,
3187-                     3 ,
3188-                 )
3189-                 return  "zeuz_failed" 
3159+         Element  =  None 
3160+         get_element  =  False 
3161+         scroll_direction  =  "" 
3162+         offset  =  "" 
3163+         pixel  =  750 
3164+         for  left , mid , right  in  step_data :
3165+             mid  =  mid .strip ().lower ()
3166+             if  "action"  in  mid :
3167+                 scroll_direction  =  right .strip ().lower ()
3168+             elif  mid  ==  "element parameter" :
3169+                 get_element  =  True 
3170+             elif  left .strip ().lower () ==  "pixels" :
3171+                 pixel  =  int (right .strip ().lower ())
31903172
3191-             CommonUtil .ExecLog (
3192-                 sModuleInfo ,
3193-                 "Element inside which instructed to scroll has been found. Scrolling thorugh it" ,
3194-                 1 ,
3195-             )
3196-         else :
3197-             CommonUtil .ExecLog (sModuleInfo , "Scrolling through main window" , 1 )
3173+         if  get_element :
3174+             Element  =  LocateElement .Get_Element (step_data , selenium_driver )
31983175
3199-         scroll_direction  =  str (action_row [2 ]).strip ().lower ()
32003176        if  scroll_direction  ==  "down" :
3201-             CommonUtil .ExecLog (sModuleInfo , "Scrolling down" , 1 )
3202-             result  =  selenium_driver .execute_script (
3203-                 "%s.scrollBy(0,750)"  %  scroll_window_name , scroll_window 
3204-             )
3205-             time .sleep (2 )
3206-             return  "passed" 
3177+             offset  =  f"0,{ pixel }  
32073178        elif  scroll_direction  ==  "up" :
3208-             CommonUtil .ExecLog (sModuleInfo , "Scrolling up" , 1 )
3209-             result  =  selenium_driver .execute_script (
3210-                 "%s.scrollBy(0,-750)"  %  scroll_window_name , scroll_window 
3211-             )
3212-             time .sleep (2 )
3213-             return  "passed" 
3179+             offset  =  f"0,-{ pixel }  
32143180        elif  scroll_direction  ==  "left" :
3215-             CommonUtil .ExecLog (sModuleInfo , "Scrolling left" , 1 )
3216-             result  =  selenium_driver .execute_script (
3217-                 "%s.scrollBy(-750,0)"  %  scroll_window_name , scroll_window 
3218-             )
3219-             time .sleep (2 )
3220-             return  "passed" 
3181+             offset  =  f"-{ pixel }  
32213182        elif  scroll_direction  ==  "right" :
3222-             CommonUtil .ExecLog (sModuleInfo , "Scrolling right" , 1 )
3223-             result  =  selenium_driver .execute_script (
3224-                 "%s.scrollBy(750,0)"  %  scroll_window_name , scroll_window 
3225-             )
3226-             time .sleep (2 )
3227-             return  "passed" 
3228-         else :
3229-             CommonUtil .ExecLog (
3230-                 sModuleInfo ,
3231-                 "Value invalid. Only 'up', 'down', 'right' and 'left' allowed" ,
3232-                 3 ,
3233-             )
3234-             result  =  "zeuz_failed" 
3235-             return  result 
3183+             offset  =  f"{ pixel }  
3184+ 
3185+         CommonUtil .ExecLog (sModuleInfo , f"Scrolling { scroll_direction }  , 1 )
3186+         selenium_driver .execute_script (f"{ 'arguments[0]'  if  Element  is  not None  else  'window' } { offset }  )
3187+         time .sleep (2 )
3188+         return  "passed" 
32363189
32373190    except  Exception :
32383191        return  CommonUtil .Exception_Handler (sys .exc_info ())
0 commit comments