File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed 
Framework/Built_In_Automation/Web/Selenium Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -3180,7 +3180,12 @@ def Scroll(step_data):
31803180def  scroll_to_element (step_data ):
31813181    sModuleInfo  =  inspect .currentframe ().f_code .co_name  +  " : "  +  MODULE_NAME 
31823182    global  selenium_driver 
3183+     use_js  =  False 
31833184    try :
3185+         for  row  in  step_data :
3186+ 
3187+             if  "use js"  in  row [0 ].lower ():
3188+                 use_js  =  row [2 ].strip ().lower () in  ("true" , "yes" , "1" )
31843189        scroll_element  =  LocateElement .Get_Element (step_data , selenium_driver )
31853190        if  scroll_element  in  failed_tag_list :
31863191            CommonUtil .ExecLog (
@@ -3193,9 +3198,13 @@ def scroll_to_element(step_data):
31933198            "Element to which instructed to scroll has been found. Scrolling to view it" ,
31943199            1 ,
31953200        )
3196-         actions  =  ActionChains (selenium_driver )
3197-         actions .move_to_element (scroll_element )
3198-         actions .perform ()
3201+         if  use_js :
3202+             selenium_driver .execute_script ("arguments[0].scrollIntoView(true);" , scroll_element )
3203+         else :
3204+             actions  =  ActionChains (selenium_driver )
3205+             
3206+             actions .move_to_element (scroll_element )
3207+             actions .perform ()
31993208        return  "passed" 
32003209
32013210    except  Exception :
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments