This is a simple python script to interact with BlueStacks using ADB.
- Python 3.9+
- Testing BlueStacks version: 10.10.7.1001
- BlueStacks Multi-instance Manager
- ADB tools
Clone the repository and install the requirements.
git clone https://github.com/SyXuan/BlueStacksADB.git
cd BlueStacksADB
pip install -r requirements.txt
pip install -e .
Start an Android app on BlueStacks.
from bluestacksadb import BAInstance
instance = BAInstance(
target_instance='Rvc64',
target_package='com.android.package.name',
)
instance.run()
Get the screen size of BlueStacks.
screen_size = instance.get_screen_size()
print(screen_size)
Click the screen on BlueStacks. The coordinates are normalized to the screen size. For example, if the screen size is 1920x1080, then 0.9, 0.1 is the point at (1920 * 0.9, 1080 * 0.1).
instance.click(0.9, 0.1)
Stop the BlueStacks instance.
instance.stop()
target_instance
: The instance name of BlueStacks. Default isRvc64
(Android 11).target_package
: The package name of the Android app.bluestacks_path
: The path to the BlueStacks installation directory. Default isC:\Program Files\BlueStacks_nxt\HD-Player.exe
.bluestacks_cmd
: The command to start BlueStacks. Default islaunchApp
.adb_path
: The path to the ADB executable. Default isplatform-tools/adb.exe
.adb_url
: The URL of the ADB server. Default is127.0.0.1:5555
.
This project is licensed under the MIT License - see the LICENSE file for details.