Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webdriver Chrome Path #177

Closed
muhammedtufekyapan opened this issue Jun 19, 2020 · 11 comments
Closed

Webdriver Chrome Path #177

muhammedtufekyapan opened this issue Jun 19, 2020 · 11 comments

Comments

@muhammedtufekyapan
Copy link

Hi everyone,

I try to use webdrivers on Heroku. My local tests are great but it does not work on Heroku.

Lastly I add;

Selenium::WebDriver::Chrome.path = ENV['GOOGLE_CHROME_SHIM'] if ENV['GOOGLE_CHROME_SHIM'].present?
driver = Selenium::WebDriver.for :chrome

before my task code.

When I run;

heroku run which google-chrome

I got

/app/.apt/usr/bin/google-chrome

Based on this I define GOOGLE_CHROME_SHIM = /app/.apt/usr/bin/google-chrome

After this When I try to push project I got error like this;

remote: ! Selenium::WebDriver::Error::WebDriverError: not a file: "/app/.apt/usr/bin/google-chrome"

How can I fix this?

@jorbs
Copy link

jorbs commented Jun 25, 2020

Hi,

Were you able to fix this error?

@kapoorlakshya
Copy link
Collaborator

@muhammedtufekyapan @jorbs Are you using heroku-buildpack-google-chrome? If yes, then please take a look at the instructions here: https://github.com/titusfortner/webdrivers/wiki/Heroku-buildpack-google-chrome

@kapoorlakshya
Copy link
Collaborator

And also make sure heroku-buildpack-chromedriver is not installed.

@jorbs
Copy link

jorbs commented Jun 25, 2020

@kapoorlakshya thank you for your response. Yes, I am using heroku-buildpack-google-chrome and removed the chromedriver buildpack from my app.json. It happens that I am still getting

Selenium::WebDriver::Error::WebDriverError: not a file: "/app/.apt/usr/bin/google-chrome-stable"

@jorbs
Copy link

jorbs commented Jun 25, 2020

More info:
I have ssh'ed my Heroku test env and noticed that:

~ $ ls -la /app/.apt/usr/bin/google-chrome-stable
lrwxrwxrwx 1 u34628 dyno 32 Jun 19 20:12 /app/.apt/usr/bin/google-chrome-stable -> /opt/google/chrome/google-chrome
~ $ ls -la /opt/google/chrome/google-chrome
ls: cannot access '/opt/google/chrome/google-chrome': No such file or directory

The GOOGLE_CHROME_SHIM var points to a link and so that points to a invalid file.

@kapoorlakshya
Copy link
Collaborator

kapoorlakshya commented Jun 26, 2020

Hmm... that's strange. This is where that ENV var magic is happening: https://github.com/heroku/heroku-buildpack-google-chrome/blob/master/bin/compile#L191-L192

And just to confirm, you're getting the not a file error even with only having this line before launching the browser:

Selenium::WebDriver::Chrome.path = ENV['GOOGLE_CHROME_SHIM'] if ENV['GOOGLE_CHROME_SHIM'].present?

Right?

I don't have a Heroku CI account to troubleshoot this myself, so I am going to have to rely on you to assist me with debugging this.

@jorbs
Copy link

jorbs commented Jun 26, 2020

@kapoorlakshya Yes. But luckly I addessed the issue. I added buildpacks in the test env as well and it worked!

@kapoorlakshya
Copy link
Collaborator

@jorbs oh good! Can you share what exactly you did? We can add it to the Wiki to help out others, and then close this issue.

@jorbs
Copy link

jorbs commented Jun 26, 2020

First off, the Heroku google chrome buildpack works fine in my production app.

The not a file error was happening in the test environment because the buildpacks configuration was only in the root of my app.json. So I decided to include it in the "test" env as well and the error gone. Here is a piece of my app.json:

{
  "buildpacks": [
    ...
    {
      "url": "heroku/ruby"
    },
    {
      "url": "https://github.com/heroku/heroku-buildpack-google-chrome"
    }
  ],
  "env": { ... },
  "environments": {
    "test": {
      "buildpacks": [
        {
          "url": "heroku/nodejs"
        },
        {
          "url": "heroku/ruby"
        },
        {
          "url": "https://github.com/heroku/heroku-buildpack-google-chrome"
        }
      ],
      ...
  }
 }

Let me know it is clear.

@kapoorlakshya
Copy link
Collaborator

@jorbs Thank you!

@muhammedtufekyapan Can you try what @jorbs has shared above? I would like to close this issue if we don't need to troubleshoot this any further.

@kapoorlakshya
Copy link
Collaborator

Closing this due to lack of response + we have a solution. Feel free to revive this if needed.

Sinetheta added a commit to Sinetheta/whattheshift that referenced this issue Oct 18, 2020
Heroku isn't finding Chrome so I'm going to follow the suggestion
titusfortner/webdrivers#177 (comment)
Sinetheta added a commit to Sinetheta/whattheshift that referenced this issue Oct 18, 2020
Heroku isn't finding Chrome so I'm going to follow the suggestion
titusfortner/webdrivers#177 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants