ultrafunkamsterdam / undetected-chromedriver

Custom Selenium Chromedriver | Zero-Config | Passes ALL bot mitigation systems (like Distil / Imperva/ Datadadome / CloudFlare IUAM)
https://github.com/UltrafunkAmsterdam/undetected-chromedriver
GNU General Public License v3.0
9.08k stars 1.09k forks source link

Heroku Deploy (Linux): TypeError: expected str, bytes or os.PathLike object, not NoneType #193

Closed kiprasvitas closed 3 years ago

kiprasvitas commented 3 years ago

Whenever I deploy undetected chromedriver (the latest version) to heroku (Linux based), I get the following error:

image

For whatever reason, it throws TypeError: expected str, bytes or os.PathLike object, not NoneType on line 268 in the v2.py file.

image

I can't seem to fix it and any help or further heroku functionality would help. Thanks!

ultrafunkamsterdam commented 3 years ago

As far as i know heroku is just a thin virtual layer for executing a single application. It has no display and no ability to install or run Google Chrome on it like on a full os. Why would you even want that.

kiprasvitas commented 3 years ago

Well, here's the issue. I want to scrape website data from a website that currently would detect any webdrivers such as the regular chromium webdriver. Heroku does support selenium with chrome webdrivers, but they have to include Binary Build Packs which give Heroku the necessary binary data for the driver. I however, wanted to run a scraper using your webdriver on Heroku, but it throws that error. Is there a way to install a binary build packet on Heroku for this webdriver?

kiprasvitas commented 3 years ago

Okay, I may have just figured it out. I am really being dumb here. Apparently, according to this repo: https://github.com/utsanjan/Google-Meet-Attender-Bot/tree/29b580fa09d72f10308cef5d5199c49fdc69dd74 It shows how I can launch my repo successfully to Heroku using your driver.

Steps: (for anyone else who is having the issue)

0. Clone the repo.
1. Install requirements `$ pip install -r requirements.txt`.
2. Run command `$ python get_cookies.py` and login to your google account.
3. Now set your meet code and your name and roll. 
5. go to heroku and create a new app and enter a unique name for your app.
6. Choose region united states.
7. Now go to settings.
8. Click on add buildpack and add the following one by one and save changes.
  $ python
  $ https://github.com/heroku/heroku-buildpack-google-chrome
  $ https://github.com/heroku/heroku-buildpack-chromedriver

9. Click on reveal configs vars

10. Add following vars one by one

    KEY                       VALUES
    CHROMEDRIVER_PATH         /app/.chromedriver/bin/chromedriver
    GOOGLE_CHROME_BIN         /app/.apt/usr/bin/google-chrome
    TZ                        Asia/Kolkata

11. Now go to Deploy Option Heroku.
12. Install heroku CLI and enter following commands one by one. 
    https://devcenter.heroku.com/articles/heroku-cli#download-and-install <-- Heroku CLI

    $ git checkout -b master
    $ heroku login
13. Open command prompt or any terminal in your current directory where all files are located.
    $ git init
    $ heroku git:remote -a your-app-name
    $ git add .
    $ git commit -am "make it better"
    $ git push heroku master

14. Then go to resource option and turn on the bot.
ultrafunkamsterdam commented 3 years ago

edit: Just saw your update while answering. good! however i foresee some issue with those path's which are dictated by heroku. Good luck!

Then find out how to install the Chrome Browser using these "binary build packs", or search for documentation to setup a regular webdriver and chrome and get that to work first. Otherwise just use your own machine to scrape? I'm not going to support or invest costly time to support all kind of edge cases for individuals where heroku is one of them. This way i don't find time to fix problems like cloudflare/Akamai for example.