title: "The provided double value is non-finite" error when attempting to get the locate an element using Selenium and Python
body: <p>I am trying to get selenium to scroll down to a button in a website that has the text 'Try it out!' inside the button.</p>
  <p>My problem is that there are no uniquely ID'd elements around the button to which I could scroll the view to. In addition, when I inspect the website with dev tools and search from the text 'Try it out!' in the HTML I get 72 results. I figured out that I need the 18th button but I am unable to get the browser to scroll to the button. Instead I get an error saying &quot;The provided double value is non-finite&quot;.</p>
  <p>Could you please look at the code below and give me an explanation to why I the browser is not scrolling down to the button?</p>
  <pre><code>from selenium import webdriver
  from time import sleep
  from selenium.webdriver.common.action_chains import ActionChains
  import pathlib
  
  # Get path to chromedriver
  file_path = pathlib.Path(__file__).parent.absolute()
  chromedriver_path = str(file_path)+&quot;\\chromedriver.exe&quot;
  
  class Scraper:
      def __init__(self):
          
          # Open website
          self.driver = webdriver.Chrome(chromedriver_path)
          print(self.driver)
          self.driver.get(
              &quot;https://flespi.io/gw/#/tags/!/devices/get_devices_dev_selector_messages&quot;)
          sleep(5)
          
          # Get the 18th button that says 'Try it out!'. Position()=17 because starts with 0.
          element = self.driver.find_element_by_xpath(
              '(//input[@value=&quot;Try it out!&quot;])[position()=17]')
          
          # Scroll to the button and click it
          actions = ActionChains(self.driver)
          actions.move_to_element(element).perform()
          element.click()
  
          sleep(5)
  
  Scraper()
  </code></pre>