title: Scrolling to element using webdriver?
body: <p>I am still learning and in response to one of my questions: <a href="https://stackoverflow.com/questions/41737321/same-command-works-once-when-executed-but-throws-an-exception-when-executed-a-se?noredirect=1#comment70669855_41737321">here</a>, I was told to that it might be due because the element in question is not in view. </p>
  
  <p>I looked through the documentation and SO, here was the most relevant answer: <a href="https://stackoverflow.com/questions/3401343/scroll-element-into-view-with-selenium">here</a></p>
  
  <p>You can use the "org.openqa.selenium.interactions.Actions" class to move to an element:</p>
  
  <pre><code>WebElement element = driver.findElement(By.id("my-id"));
  Actions actions = new Actions(driver);
  actions.moveToElement(element);
  ## actions.click();
  actions.perform();
  </code></pre>
  
  <p>When I try to use the above to scroll to the element:
  It says WebElement not defined.</p>
  
  <p>I think this is because I have not imported the relevant module. Can someone point out what I am supposed to import?</p>
  
  <p>Edit:
  As pointed out by alecxe, this was java code.</p>
  
  <p>But in the meantime right after trying to figure it out for some time. I have found out the import method for WebElement:</p>
  
  <pre><code>from selenium.webdriver.remote.webelement import WebElement
  </code></pre>
  
  <p>Might help someone like me.</p>
  
  <p>The how of it is also a good lesson, IMO:</p>
  
  <p>Went to: <a href="http://selenium-python.readthedocs.io/api.html#module-selenium.webdriver.remote.webelement" rel="noreferrer">Documentation</a>
  The </p>
  
  <pre><code>class selenium.webdriver.remote.webelement.WebElement(parent, id_, w3c=False)
  </code></pre>
  
  <p>Need to be separated into the command form mentioned above.</p>