Skip to content

Instantly share code, notes, and snippets.

@Akianonymus
Last active April 8, 2024 17:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Akianonymus/e54f4c826786c2460047c590522d197f to your computer and use it in GitHub Desktop.
Save Akianonymus/e54f4c826786c2460047c590522d197f to your computer and use it in GitHub Desktop.
Run selenium with chrome on termux

Setup chromium - Normal Termux ( recommended )

Install tur and x11 repo

Chromium is there in tur repo and x11 repo contains some dependencies of chromium

Run these commands

pkg install -y tur-repo x11-repo

Install chromium and other required packages

pkg install -y chromium xorg-xerver-xvfb

Now to use chromium, you must use it with installed chromedriver, setup the virtual display ( like PyVirtualDisplay for python ) and do not use --headless=new mode.

With --headless, it should work without virtual display.



Install required packages by Microsoft-Rewards-bot

pkg install -y python python-tkinter
  • Clone the repo

  • Setup the repo like how you would do normally

  • In the command, --virtual-display -no-webdriver-manager must be added and do not add --headless ( otherwise it will throw an error ).

Example:

python3 ms_rewards_farmer.py --no-images --session --superfast --no-webdriver-manager --virtual-display 
@Akianonymus
Copy link
Author

Akianonymus commented Apr 23, 2023

No need to do follow this if normal termux (above) method was used.

Setup chromium - Alpine linux method

Install alpine linux

Alpine linux because it is very small in size, and fast under proot.

You can skip this section if you have alpine linux already installed.

Original repo for alpine linux: https://github.com/illvart/termux-alpine

Run these commands

Follow instructions that appear, for more info, refer https://github.com/illvart/termux-alpine

pkg install -y git
pkg install -y ncurses-utils

cd $HOME && \
    git clone -b main https://github.com/illvart/termux-alpine.git && \
    cd termux-alpine && \
    chmod +x setup-termux-alpine

./setup-termux-alpine

Enter alpine proot

termux-alpine

Install required packages

apk add git chromium chromium-chromedriver openssh xvfb

Now to use chromium, you must use it with installed chromedriver, setup the virtual display ( like PyVirtualDisplay for python ) and do not use --headless=new mode.

With --headless, it should work without virtual display.



Example: Run https://github.com/farshadz1997/Microsoft-Rewards-bot

Install required packages by Microsoft-Rewards-bot

For Alpine linux

apk add py3-pip python3-tkinter
  • Clone the repo

  • Setup the repo like how you would do normally

  • In the command, --virtual-display -no-webdriver-manager must be added and do not add --headless ( otherwise it will throw an error ).

Example:

python3 ms_rewards_farmer.py --no-images --session --superfast --no-webdriver-manager --virtual-display 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment