title: How to stop the automatic scroll-down when user scroll up?
body: <p>I want to stop the automatic scroll down  when user scroll up by mouse. I have made a function that scroll's down the webpage automatically after every 2 second but I want to stop that automatic scroll when user scroll up by mouse
  My code:</p>
  <pre><code>from selenium import webdriver
  import time
  driver=webdriver.Chrome() 
  driver.get(&quot;https://YouTube.com&quot;) 
  driver. maximize_window() 
  a=input('press y if you want to scroll down') 
  if a=='y':
      while(True) :                  
            driver. execute_script(&quot;window.scrollBy(0, 150) &quot;, &quot;&quot;)
            time.sleep(2) 
  else:
  Print(&quot; Ok&quot;) 
  
       
  </code></pre>