- Testing and finding solutions is really difficult, so I won't continue this project.
You can wait for me to release something similar for android at Moe-Moe.- I dont have time to continue that project, also i renamed it to AwChromium.
- Also thank you all :D, who visted my tutorial, and watch my video, its really cool !!!
- Ai không biết tiếng anh thì sài google dịch đi !
- This tutorial will help you how to install and use Selenium on Termux for Android.
- PLease give me star if you like this tutorial <3.
- If you receive this error
OSError: [Errno 8] Exec format error: '/data/data/com.termux/files/usr/lib/python
X.YY/site-packages/selenium/webdriver/common/linux/selenium-manager'
. - Where X.YY is your Python version, example 3.8, 3.9, 3.10, 3.11, 3.12, ...
- That means you haven't installed the required package.
- Custom distro & modded termux WON'T WORK.
- Termux -> F-Droid.
Step | Command |
---|---|
1 | Open Termux |
2 | Allow access to storage memory |
3 |
|
4 | Force exit Termux |
5 | Reopen Termux |
6 | Update & Upgrade package |
7 |
|
8 | Install pip (they seperated it from python) |
9 |
|
10 | Install selenium |
11 |
|
12 | PLEASE MAKE SURE YOUR SELENIUM VERSION <= 4.9.1 |
Chromium | Firefox |
---|---|
|
|
Step | Command |
---|---|
1 | |
2 |
|
3 | For first time you will see it show something like New 'localhost:1 ()' desktop is localhost:1 , then localhost:1 is your display ip address |
4 | You can download VNC Viewer from CH Play to view your webdriver, use localhost:1 as the ip address |
Type | Video | Chromium | Firefox |
---|---|---|---|
Headless | Unknown |
|
|
Non-Headless | example.mp4 |
|
|
Chrome | Firefox |
---|---|
chrome.mp4 |
firefox.mp4 |
- This is why you should use chromium instead of chrome and firefox
- All data will be ERASED.
- Bug/crash/error....
-
You need Android SDK to use adb control.
yes | pkg install wget -y cd $HOME wget https://github.com/Lzhiyong/termux-ndk/releases/download/android-sdk/android-sdk-aarch64.zip unzip android-sdk-aarch64.zip -d android-sdk rm -r android-sdk-aarch64.zip echo "export ANDROID_HOME=$HOME/android-sdk" >> $HOME/.bashrc echo "export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools" >> $HOME/.bashrc
-
You MUST install this to make it work.
yes | pkg install android-tools -y yes | pkg install x11-repo -y yes | pkg install tur-repo -y yes | pkg install chromium -y
-
You need ADB Server for selenium.
For rooted device
-
This is the easiest option.
su -c stop adbd && su -c start adbd su -c setprop service.adb.tcp.port 5555
For Android >= 11 and above
- you can watch Video tutorial for how to do that.
- Run
adb pair localhost:<port_1> <security_code>
. <port_1>
!=<port_2>
, same port but it changes when pairing.- Run
adb connect localhost:<port_2>
. - Run
adb devices
. - Run
adb tcpip 5555
.
For Android < 11, you *MUST have PC/Laptop
-
Go to your phone Settings.
-
Find Developer Mode.
-
Enable Developer Mode.
-
Follow me this step.
Settings 1 Settings 2 -
If your device doesn't match or is not similar to my phone, then try this solution.
-
Connect your phone to PC/Laptop using a USB cable.
-
On PC/Laptop, open the shell with administrator.
-
Next, you need to install Choco (This is a very easy way to install adb).
-
Run
Get-ExecutionPolicy
. -
Run
Set-ExecutionPolicy AllSigned
. -
Run
Set-ExecutionPolicy Bypass -Scope Process
. -
Run
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
. -
After installing Choco, run
choco install adb
. -
Open the command prompt on PC/Laptop, run
adb devices
. -
Then continue run
adb tcpip 5555
. -
*And run this (I don't know if it's very important or not, but my Oppo phone needs this to run successfully) to allow termux write secure settings
adb shell pm grant com.termux android.permission.WRITE_SECURE_SETTINGS
. -
Now you can unplug the USB cable.
-
- Make sure you have enabled the ADB Server.
- Open Termux.
- Run
adb kill-server
. - Then run
adb devices
. - Make sure you only see
emulator-5554
in the list.
- If you turn off or restart your device, you must enable ADB Server AGAIN.
- If you close termux app and open again, you need to active adb server by run
adb devices
.
-
This apk only support arm64, for 32 bit i dont know.
-
Download link (current selenium only support chromium <= 110).
-
Or use this link for fast download.
-
Make sure you CLOSED all chromium instances before run this code (Chrome, Chrome Dev, Chrome Canary, Kiwi Browser, Brave, ....).
import os os.system("adb devices") from selenium import webdriver options = webdriver.ChromeOptions() options.add_argument("--no-sandbox") options.add_argument("--disable-dev-shm-usage") options.add_experimental_option("androidPackage", "org.chromium.chrome.stable") driver = webdriver.Chrome(options=options) driver.get("https://www.google.com") print("Page title:", driver.title) driver.quit()
- This means you must install JAVA.
cd $HOME wget https://github.com/lzhiyong/termux-ndk/releases/download/openjdk/openjdk-11.0.12-aarch64.zip unzip openjdk-11.0.12-aarch64.zip -d openjdk-11.0.12 rm -r openjdk-11.0.12-aarch64.zip echo "export PATH=$PATH:$HOME/openjdk-11.0.12/bin" >> $HOME/.bashrc echo "export JAVA_HOME=$HOME/openjdk-11.0.12" >> $HOME/.bashrc
- Special thanks to:
- 🌟Mauro🌟
- Github: @mauro199304
- Telegram: @Jovtyc
- 🌟Phong🌟
- Telegram: @DZ0Phong
- 🌟Mauro🌟
- @remo7777
- @lzhiyong
- Termux Desktop Xfce
- Termux Issues