title: How to continously scroll down a page until an element is located? Python selenium
body: <p>I'm baffled by the load more button for the skills section in Linkedin.  I receive this error in finding the xpath for the button: <code>selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element</code></p>
  
  <p>The issue is that my element is not visible on the page, so I've been trying to find a way to continuously scroll on the page until the button is visible. I'm trying to do a forloop of multiple profiles.</p>
  
  <p>My relevant code:</p>
  
  <pre><code>import parameters
  from selenium.webdriver.common.action_chains import ActionChains
  from selenium import webdriver
  
  ChromeOptions = webdriver.ChromeOptions()
  driver = webdriver.Chrome('C:\\Users\\Root\\Downloads\\chromedriver.exe')
  
  driver.get('https://www.linkedin.com/login?fromSignIn=true&amp;trk=guest_homepage-basic_nav-header-signin')
  sleep(0.5)
  
  username = driver.find_element_by_name('session_key')
  
  username.send_keys(parameters.linkedin_username)
  sleep(0.5)
  
  password = driver.find_element_by_name('session_password')
  password.send_keys(parameters.linkedin_password)
  sleep(0.5)
  
  sign_in_button = driver.find_element_by_xpath('//button[@class="btn__primary--large from__button--floating"]')
  sign_in_button.click()
  
  driver.get('https://www.linkedin.com/in/kate-yun-yi-wang-054977127/?originalSubdomain=hk')
  
  loadmore_skills=driver.find_element_by_xpath('//button[@class="pv-profile-section__card-action-bar pv-skills-section__additional-skills artdeco-container-card-action-bar artdeco-button artdeco-button--tertiary artdeco-button--3 artdeco-button--fluid"]')
  </code></pre>
  
  <p><strong>Attempts</strong>
  1.</p>
  
  <pre><code>actions = ActionChains(driver)
  actions.move_to_element(loadmore_skills).perform()
  #actions.move_to_element_with_offset(loadmore_skills, 0, 0).perform()
  loadmore_skills.click()
  </code></pre>
  
  <p>With <code>actions.move_to_element</code> the page scrolls just below the element, so that the element is no longer visible, and the same error subsequently occurs.</p>
  
  <p>I have also tried move_to_element_with_offset, but this hasn't changed where the page scrolls to.</p>
  
  <p>2.</p>
  
  <pre><code>coordinates = loadmore_skills.location_once_scrolled_into_view 
  driver.execute_script('window.scrollTo({}, {});'.format(coordinates['x'], coordinates['y']))
  </code></pre>
  
  <p>This returns the same error message</p>
  
  <p>3.</p>
  
  <pre><code>loadmore_skills=WebDriverWait(driver,30).until(EC.element_to_be_clickable((By.XPATH, '//button[@class="pv-profile-section__card-action-bar pv-skills-section__additional-skills artdeco-container-card-action-bar artdeco-button artdeco-button--tertiary artdeco-button--3 artdeco-button--fluid"]')))
  </code></pre>
  
  <p>This returns the same error, as well.</p>
  
  <p>4.</p>
  
  <pre><code>driver.execute_script("arguments[0].scrollIntoView();", loadmore_skills)
  </code></pre>
  
  <p>Not sure how else to do this. Your help is greatly appreciated.</p>
  
  <p><em>UPDATE:</em>
  Trying @Dipak solution moves me to the bottom of the page, and the element cannot be clicked:
  <a href="https://i.stack.imgur.com/8702z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8702z.png" alt="enter image description here"></a></p>
  
  <p>Error Traceback:</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:/Users/Root/PycharmProjects/Quant/skillstest.py", line 60, in &lt;module&gt;
      EC.element_to_be_clickable((By.XPATH, "//span[text()='Show more']")))
    File "C:\Users\Root\PycharmProjects\Quant\venv\lib\site-packages\selenium\webdriver\support\wait.py", line 80, in until
      raise TimeoutException(message, screen, stacktrace)
  selenium.common.exceptions.TimeoutException: Message: 
  </code></pre>