title: Struggling to get Selenium to finish automatic checkout
body: <p>I've been playing around with Selenium and have been trying to get my automated checkout working. So far it's been pretty successful, but I've hit a snag and can't seem the end part of my code working. I've tried arranging my 'sleeps' and 'implicit_waits' in every way I can think of but to no success. I keep getting thrown &quot;selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: //*[@id=&quot;creditCardNumber&quot;]&quot; If someone can help me get this going I would really appreciate it!</p>
  <pre><code>
  from selenium.webdriver import Firefox
  from selenium import webdriver
  from selenium.webdriver.support.select import Select
  import time
  
  driver = Firefox()
  action = webdriver.ActionChains(driver)
  
  
  def get_nike():
  
      driver.maximize_window()
      driver.get('https://www.nike.com/')
  
      men_shoes = driver.find_element_by_xpath('/html/body/div[1]/div[3]/header/div/div[1]/div[2]/nav/div[2]/ul/li[2]/a')
      action.move_to_element(men_shoes)
      action.perform()
  
      new_releases = driver.find_element_by_xpath('/html/body/div[1]/div[3]/header/div/div[1]/div[2]/nav/div[2]/ul/li[2]/div/div/div[1]/a[1]')
      avoid_wrong_selection = driver.find_element_by_xpath('/html/body/div[1]/div[3]/header/div/div[1]/div[2]/nav/div[2]/ul/li[2]/div/div/div[2]/a[2]')
      action.move_to_element(avoid_wrong_selection)
      action.move_to_element(new_releases)
      action.perform()
      new_releases.click()  # you have to click the element itself
  
      driver.implicitly_wait(2)
  
      selected_shoes = driver.find_element_by_xpath('//*[@id=&quot;Wall&quot;]/div/div[5]/div[2]/main/section/div/div[12]/div/figure/a[2]/div/div/img') #can also use linked text
      driver.execute_script(&quot;arguments[0].scrollIntoView();&quot;, selected_shoes) # scrolls to shoes
      selected_shoes.click()
  
      get_size = driver.find_element_by_xpath('/html/body/div[1]/div[2]/div/div/div[3]/div[3]/div[2]/div/div/div[4]/form/div[1]/fieldset/div/div[10]/label')
      action.move_to_element(get_size)  # selects size
      get_size.click()
  
      time.sleep(1)
  
      add_bag = driver.find_element_by_xpath('/html/body/div[1]/div[2]/div/div/div[3]/div[3]/div[2]/div/div/div[4]/form/div[2]/div/div') #requires web element
      action.move_to_element(add_bag) # adds item to bag
      add_bag.click() 
  
      to_checkout = driver.find_element_by_xpath('/html/body/div[1]/div[2]/div/div/div[4]/div/div/div/div/div/div/div/div/div/div[3]/div/button[2]')
      action.move_to_element(to_checkout) # brings you to cart
      to_checkout.click()
  
      first_name = driver.find_element_by_xpath('//*[@id=&quot;firstName&quot;]')
      first_name.send_keys(&quot;Bingo&quot;)
  
      last_name = driver.find_element_by_xpath('//*[@id=&quot;lastName&quot;]')
      last_name.send_keys(&quot;Bongo&quot;)
  
      transition_address = driver.find_element_by_xpath('//*[@id=&quot;search-address-input&quot;]')
      transition_address.send_keys('1453 E curfluffle street')
  
      manual_address = driver.find_element_by_xpath('/html/body/div[1]/div/div[3]/div/div[2]/div/div/main/section[2]/div/div[2]/form/div/div/div/div[1]/div[4]/div/div[2]/div/div/ul/li[3]/a')
      manual_address.click()
  
      real_address = driver.find_element_by_xpath('//*[@id=&quot;address1&quot;]') # types address
      real_address.send_keys('53 sterling street')
  
      city = driver.find_element_by_xpath('//*[@id=&quot;city&quot;]') # types city
      city.send_keys('pittsburgh')
  
      state_dropdown = driver.find_element_by_xpath('//*[@id=&quot;state&quot;]')
      selections = Select(state_dropdown) # selects state from the dropdown
      
      selections.select_by_value(&quot;PA&quot;)
  
      zip_code = driver.find_element_by_xpath('//*[@id=&quot;postalCode&quot;]')
      zip_code.send_keys('15203') #sends zip code
  
      email = driver.find_element_by_xpath('//*[@id=&quot;email&quot;]')
      email.send_keys('gythfnjgfvn@gmail.com')
  
      phone_number = driver.find_element_by_xpath('//*[@id=&quot;phoneNumber&quot;]')
      phone_number.send_keys('456-906-2354')
  
      save_and_continue = driver.find_element_by_xpath('/html/body/div[1]/div/div[3]/div/div[2]/div/div/main/section[2]/div/div[2]/form/div/div/div/div[2]/button')
      action.move_to_element(save_and_continue)
      save_and_continue.click()
  
      time.sleep(1)
  
      continue_to_payment = driver.find_element_by_xpath('/html/body/div[1]/div/div[3]/div/div[2]/div/div/main/section[2]/div/div[3]/div/button')
      action.move_to_element(continue_to_payment)
      continue_to_payment.click()
  
      
      cc_number = driver.find_element_by_xpath('//*[@id=&quot;creditCardNumber&quot;]')
      driver.implicitly_wait(5)
      #scroll down to card info and enter card info
      driver.execute_script(&quot;arguments[0].scrollIntoView();&quot;, cc_number)
      time.sleep(2)
      cc_number.send_keys('123456789101112')
  
  get_nike()
  
  </code></pre>
  <p>The problem in particular the end.</p>
  <pre><code>    continue_to_payment = driver.find_element_by_xpath('/html/body/div[1]/div/div[3]/div/div[2]/div/div/main/section[2]/div/div[3]/div/button')
      action.move_to_element(continue_to_payment)
      continue_to_payment.click()
  
      
      cc_number = driver.find_element_by_xpath('//*[@id=&quot;creditCardNumber&quot;]')
      driver.implicitly_wait(5)
      #scroll down to card info and enter card info
      driver.execute_script(&quot;arguments[0].scrollIntoView();&quot;, cc_number)
      time.sleep(2)
      cc_number.send_keys('123456789101112')
  
  </code></pre>