title: Run Selenium with chromedriver in Jenkins
body: <p>I'm trying to run a basic script using Selenium with chromedriver within Jenkins (CI).</p>
  
  <p>Basically I did all the steps that should be taken to run the script but still i'm getting an errors like:</p>
  
  <blockquote>
    <p>WebDriverException: Message: Service chromedriver unexpectedly exited. Status code was: 127</p>
  </blockquote>
  
  <p>or</p>
  
  <blockquote>
    <p>'chrome' executable needs to be in PATH.</p>
  </blockquote>
  
  <p>I've installed the chrome driver plugin in Jenkins (basically i've installed any plugin that can be related) but still i'm not able to run the script.</p>
  
  <p>the script is:</p>
  
  <pre><code>import os
  import requests
  from selenium import webdriver
  from selenium.webdriver.chrome.options import Options
  from selenium.webdriver.common.keys import Keys
  
  def chat():
  
  # setting Chrome headless webdriver
  chrome_options = Options()
  chrome_options.add_argument("--headless")
  chrome_options.add_argument("--window-size=1920x1080")
  chrome_driver = os.getcwd() + "/chromedriver"
  driver = webdriver.Chrome(chrome_options=chrome_options, 
  executable_path=chrome_driver)
  
  
  # set url's
  website_url = "&lt;some url&gt;"
  
  # verify the website and BO are live
  web = requests.get(website_url)
  if web.status_code != 200:
      raise Exception("Error in URL's")
  else:
      driver.get(website_url)
      driver.find_element_by_id("some_id").click()
      driver.quit()
  </code></pre>
  
  <p>The code is just to show how i call chromedriver</p>
  
  <p>What am i doing wrong? am i missing a set to run this kind of script?</p>