title: Deploying a Spring Boot-Selenium app on Heroku or any cloud service platform
body: <p>I'm currently using Spring Boot App to Build a LineBot backend Server,and intend to deploy this app to Heroku.</p>
  <p>Everything is good except when it comes to using Selenium to webcrawl chrome on Heroku.</p>
  <p>My current tests result are as follows:</p>
  <ol>
  <li>Adding chromdriver.exe in resourece file and selenium  in pom.xml, tested locally selenium and chrome worked fine, but after I deploy on Heroku. My app seems can't find the path of the chromeDriver.</li>
  </ol>
  <pre><code>        System.getProperties().setProperty(&quot;webdriver.chrome.driver&quot;,
                  &quot;src/test/resources/chromedriver.exe&quot;);
  </code></pre>
  <ol start="2">
  <li>So I follow this python-Based tutorial to set my spring boot app on heroku:
  <a href="https://www.andressevilla.com/running-chromedriver-with-python-selenium-on-heroku/" rel="nofollow noreferrer">https://www.andressevilla.com/running-chromedriver-with-python-selenium-on-heroku/</a>
  And I changed the chromedriver's path to match heroku's Config Vars, but the result was still the same,app seemed couldn't find the path of the chromeDriver.</li>
  </ol>
  <pre><code>        System.getProperties().setProperty(&quot;webdriver.chrome.driver&quot;,
                  System.getenv(&quot;CHROMEDRIVER_PATH&quot;));
  </code></pre>
  <p>Below is what app on Heroku's log shows:</p>
  <pre><code>remote:        java.lang.IllegalStateException: The driver executable does not exist: /app/.chromedriver/bin/chromedriver
  remote:         at linechrordbot.service.selenium.SeleniumTest.testGetGooglePage(SeleniumTest.java:36)
  </code></pre>
  <p>Any help or direction to solve the problem is much appreciate! and if there are other platforms to deploy a backend server with selenium are consider good news to me!</p>
  <p>what my overall test code looks like:</p>
  <pre><code>import static org.junit.jupiter.api.Assertions.assertEquals;
  
  import org.junit.jupiter.api.Test;
  import org.openqa.selenium.By;
  import org.openqa.selenium.WebDriver;
  import org.openqa.selenium.WebElement;
  import org.openqa.selenium.chrome.ChromeDriver;
  import org.openqa.selenium.chrome.ChromeOptions;
  import org.springframework.boot.test.context.SpringBootTest;
  
  import lombok.extern.slf4j.Slf4j;
  
  @SpringBootTest
  @Slf4j
  public class SeleniumTest {
  
      @Test
      public void testGetGooglePage() {
          String uri = &quot;http://xxxxxxxxx.......&quot;;
  
          // where to find chromedirver
        //System.getProperties().setProperty(&quot;webdriver.chrome.driver&quot;,
        //&quot;src/test/resources/chromedriver.exe&quot;);
          System.getProperties().setProperty(&quot;webdriver.chrome.driver&quot;,
                  System.getenv(&quot;CHROMEDRIVER_PATH&quot;));
  
          ChromeOptions chromeOptions = new ChromeOptions();
          chromeOptions.addArguments(&quot;--no-sandbox&quot;);
          chromeOptions.addArguments(&quot;--disable-dev-shm-usage&quot;);
          chromeOptions.addArguments(&quot;--headless&quot;); 
          WebDriver webDriver = new ChromeDriver(chromeOptions);
  
          webDriver.get(uri);
          WebElement webElements = webDriver.findElement(By.id(&quot;price9&quot;));
          String stockPrice = webElements.getText();
          log.info(&quot;something to show &gt;&gt;&gt; {}&quot;, stockPrice);
          webDriver.close();
          assertEquals(1, 1);
      }
  </code></pre>
  <p>Thanks in advance!</p>