Is there any way to make android emulator automation , like selenium?

we did a lot browser automation , but i am think to do some new like Android control automation ,is it possible with OB2 ? any guide will help.

yes it is possible using adb, the commands you will use the most are probably these

click: adb -s ${adbid} shell input tap ${x} ${y}
type: adb -s ${adbid} shell "input keyboard text '${string}'"
open app: adb -s ${adbid} shell monkey -p '${appName}' -c android.intent.category.LAUNCHER 1

screen text: adb -s ${adbid} shell uiautomator dump /sdcard/window_dump_${adbid}.xml && adb -s ${adbid} shell cat /sdcard/window_dump_${adbid}.xml
1 Like

well i am not familar much , where should i learn the basic first ? any videos which can guide well.

I don’t think there is any video explaining how to automate adb. however you can write functions in c# that execute the commands that I sent in cmd.

example to do the click function:

async Task<string> click(double x, double y, string adbid) {
Console.WriteLine("CLICK DEVICE " + adbid);
var processo = new Process();
var startInfo = new ProcessStartInfo {
FileName = "adb",
Arguments = $"-s {adbid} shell input tap {x} {y}",
UseShellExecute = false,
RedirectStandardOutput = true
};
processo.StartInfo = startInfo;
processo.Start();
var result = await processo.StandardOutput.ReadToEndAsync();
processo.WaitForExit();
return result;
}

await click(847.7,500.41,"127.0.0.1:21513");

before you use this code put the adb files in the root folder of openbullet

Could you send a ready-made configuration to study how to do it?