명령어 레퍼런스
Droidline 전체 명령의 파라미터, 반환값, 에러와 Python, Node.js, C#, CLI, HTTP에서의 같은 호출.
번역된 페이지입니다. 영어 문서와 내용이 다르면 영어 문서가 기준입니다. English
명령마다 하는 일, 파라미터, 반환값, 날 수 있는 에러를 보여 주고, 이어서 같은 호출을 인터페이스별로 보여 줍니다. 아무 예제에서나 언어를 고르면 페이지 전체가 그 언어로 바뀝니다. Python 예제는 d = connect()(서버 명령은 dl = Droidline())를, Node.js 예제는 const d = await connect()(const dl = new Droidline())를, C# 예제는 await using var d = await DroidlineClient.ConnectAsync()(using var client = new DroidlineClient())를 이미 실행했다고 가정합니다.
쿼리
객체로 쓰는 선택자. 모든 조건이 같은 요소 하나에서 맞아야 함. by에 넣고 value는 생략.
| 키 | 타입 | 의미 |
|---|---|---|
text | 글자 | text 완전 일치 |
textContains | 글자 | text 일부 |
textMatches | 글자 | text 전체에 맞는 정규식 |
id | 글자 | resource-id, 또는 :id/ 뒤의 이름만 |
desc | 글자 | content-desc 완전 일치 |
descContains | 글자 | content-desc 일부 |
descMatches | 글자 | content-desc 전체에 맞는 정규식 |
class | 글자 | class 이름 완전 일치 |
package | 글자 | 요소가 속한 패키지 |
clickable | true 또는 false | 노드의 clickable 값이 이 값과 같음 |
long_clickable | true 또는 false | 노드의 long_clickable 값이 이 값과 같음 |
checkable | true 또는 false | 노드의 checkable 값이 이 값과 같음 |
checked | true 또는 false | 노드의 checked 값이 이 값과 같음 |
enabled | true 또는 false | 노드의 enabled 값이 이 값과 같음 |
focused | true 또는 false | 노드의 focused 값이 이 값과 같음 |
selected | true 또는 false | 노드의 selected 값이 이 값과 같음 |
scrollable | true 또는 false | 노드의 scrollable 값이 이 값과 같음 |
editable | true 또는 false | 노드의 editable 값이 이 값과 같음 |
password | true 또는 false | 노드의 password 값이 이 값과 같음 |
visible | true 또는 false | 요소가 화면 안에 있는지. 목록은 화면 끝 바로 너머의 항목도 트리에 두는데, visible: true로 그런 항목을 건너뜀 |
bounds | [left, top, right, bottom] | dump와 find가 돌려주는 bounds [left, top, right, bottom]과 정확히 같음 |
has | 다른 쿼리 | 자손 중 하나가 이 쿼리와 맞음 |
inside | 다른 쿼리 | 조상 중 하나가 이 쿼리와 맞음 |
row | 다른 쿼리 | 같은 줄에 이 쿼리와 맞는 요소가 있음. 줄은 가장 가까운 목록(RecyclerView, ListView, GridView, 또는 자식이 여럿인 스크롤 뷰)의 항목이고, 목록 밖이면 가장 가까운 누를 수 있는 조상 |
below | 다른 쿼리 | 중심이 이 쿼리의 첫 결과보다 아래. 가까운 순서로 나옴 |
above | 다른 쿼리 | 중심이 이 쿼리의 첫 결과보다 위. 가까운 순서로 나옴 |
left_of | 다른 쿼리 | 중심이 이 쿼리의 첫 결과보다 왼쪽. 가까운 순서로 나옴 |
right_of | 다른 쿼리 | 중심이 이 쿼리의 첫 결과보다 오른쪽. 가까운 순서로 나옴 |
화면
dumpscreenshotrecordfind_imagetap_imageimage_existsfind_imageswait_image_goneocrocr_findocr_tapcurrent
dump
현재 화면 노드 트리를 반환
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
path | string | 이 로컬 파일에 JSON으로 저장 | |
all_windows | bool | false | 상태 표시줄, 키보드 같은 시스템 창도 포함 |
반환: 다음 필드를 가진 객체: package, activity, width, height, tree
d.dump("screen.json") # saved on your PCawait d.dump("screen.json"); // saved on your PCawait d.DumpAsync("screen.json"); // saved on your PCdroidline dump screen.jsoncurl -s -X POST localhost:8780/devices/_/dump \
-H 'content-type: application/json' > screen.json{"id":1,"cmd":"dump"}screenshot
화면 캡처
Android 11 이상은 접근성 스크린샷, 9~10은 처음 한 번 화면 캡처 허용 팝업
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
path | string | 이 로컬 파일에 저장. 확장자로 png/jpeg 결정 | |
format | string png | jpeg | "jpeg" | 이미지 형식 |
quality | int | 80 | JPEG 품질 1~100 |
scale | number | 1 | 축소 비율 0.1~1.0, 모바일 데이터에서 유용 |
반환: 다음 필드를 가진 객체: format, width, height, data
d.screenshot("shot.png") # saved on your PCawait d.screenshot("shot.png"); // saved on your PCawait d.ScreenshotAsync("shot.png"); // saved on your PCdroidline screenshot shot.pngcurl -s localhost:8780/devices/_/screenshot.png -o shot.png{"id":1,"cmd":"screenshot"}record
탭과 입력 녹화 켜기·끄기
선택 기능이며 켜기 전에는 꺼져 있습니다. 켜져 있는 동안 폰은 다른 앱에서 일어난 탭, 길게 누르기, 글자 변경마다 그때의 화면과 함께 action 이벤트를 보냅니다. 비밀번호 칸의 글자는 보내지 않습니다. minutes가 지나면 스스로 꺼집니다. droidline inspect가 폰을 쓰는 동안 스크립트를 만들 때 사용합니다
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
on | bool | 필수 | true면 시작, false면 중지 |
minutes | number | 30 | 이 시간이 지나면 스스로 꺼짐 |
반환: 없음
d.record(True)await d.record(true);await d.RecordAsync(true);droidline record truecurl -s -X POST localhost:8780/devices/_/record \
-H 'content-type: application/json' \
-d '{"on":true}'{"id":1,"cmd":"record","on":true}find_image
화면에서 그림 찾기
선택 기능이며 PC에서 실행됩니다. 서버가 스크린샷을 받아 비교합니다. 같은 폰의 스크린샷에서 잘라 쓰고, 화면 밀도가 다른 폰에서는 scales를 넘기세요. Android 9, 10에서는 화면 캡처 허용이 필요합니다
PC에서 실행됩니다. 서버가 폰에서 스크린샷을 받고 폰을 통해 탭합니다.
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
image | image | 필수 | 찾을 대상의 PNG나 JPEG. 같은 폰의 스크린샷에서 잘라낸 것. SDK와 CLI는 파일 경로를 받고, 전송할 때는 base64 |
threshold | number | 0.9 | 얼마나 비슷해야 찾은 것으로 볼지, 0에서 1 |
timeout | number | 10 s | 대상이 뜰 때까지 기다리는 초 |
region | list<int> | 이 영역 안에서만 찾기. 화면 픽셀 기준 왼쪽, 위, 오른쪽, 아래 순서. 더 빠르고 영역 밖은 맞지 않음 | |
scales | list<number> | 시도할 그림 크기. 1이 잘라낸 크기 그대로이며, 화면 밀도가 다른 폰이면 0.8, 1, 1.25처럼. 크기마다 시간이 더 걸림 | |
color | bool | false | 평균 색도 같아야 맞은 것으로 봄. 모양이 같은 빨간 버튼과 초록 버튼을 구분할 때 |
반환: 다음 필드를 가진 객체: x, y, bounds, score
에러: NOT_FOUND, NO_PERMISSION
d.find_image("ok-button.png")await d.findImage("ok-button.png");await d.FindImageAsync("ok-button.png");droidline find_image ok-button.pngcurl -s -X POST localhost:8780/devices/_/find_image \
-H 'content-type: application/json' \
-d '{"image":"<base64 of the PNG>"}'{"id":1,"cmd":"find_image","image":"<base64 of the PNG>"}tap_image
화면에서 그림을 찾아 가운데를 누르기
선택 기능이며 PC에서 실행됩니다. 서버가 스크린샷을 받아 비교합니다. 같은 폰의 스크린샷에서 잘라 쓰고, 화면 밀도가 다른 폰에서는 scales를 넘기세요. Android 9, 10에서는 화면 캡처 허용이 필요합니다
PC에서 실행됩니다. 서버가 폰에서 스크린샷을 받고 폰을 통해 탭합니다.
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
image | image | 필수 | 찾을 대상의 PNG나 JPEG. 같은 폰의 스크린샷에서 잘라낸 것. SDK와 CLI는 파일 경로를 받고, 전송할 때는 base64 |
threshold | number | 0.9 | 얼마나 비슷해야 찾은 것으로 볼지, 0에서 1 |
timeout | number | 10 s | 대상이 뜰 때까지 기다리는 초 |
region | list<int> | 이 영역 안에서만 찾기. 화면 픽셀 기준 왼쪽, 위, 오른쪽, 아래 순서. 더 빠르고 영역 밖은 맞지 않음 | |
scales | list<number> | 시도할 그림 크기. 1이 잘라낸 크기 그대로이며, 화면 밀도가 다른 폰이면 0.8, 1, 1.25처럼. 크기마다 시간이 더 걸림 | |
color | bool | false | 평균 색도 같아야 맞은 것으로 봄. 모양이 같은 빨간 버튼과 초록 버튼을 구분할 때 |
반환: 다음 필드를 가진 객체: x, y, score, ms
에러: NOT_FOUND, NO_PERMISSION
d.tap_image("ok-button.png", threshold=0.85)await d.tapImage("ok-button.png", { threshold: 0.85 });await d.TapImageAsync("ok-button.png", threshold: 0.85);droidline tap_image ok-button.png --threshold 0.85curl -s -X POST localhost:8780/devices/_/tap_image \
-H 'content-type: application/json' \
-d '{"image":"<base64 of the PNG>","threshold":0.85}'{"id":1,"cmd":"tap_image","image":"<base64 of the PNG>","threshold":0.85}image_exists
지금 화면에 그림이 있는지. 기다리지 않음
선택 기능이며 PC에서 실행됩니다. 서버가 스크린샷을 받아 비교합니다. 같은 폰의 스크린샷에서 잘라 쓰고, 화면 밀도가 다른 폰에서는 scales를 넘기세요. Android 9, 10에서는 화면 캡처 허용이 필요합니다
PC에서 실행됩니다. 서버가 폰에서 스크린샷을 받고 폰을 통해 탭합니다.
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
image | image | 필수 | 찾을 대상의 PNG나 JPEG. 같은 폰의 스크린샷에서 잘라낸 것. SDK와 CLI는 파일 경로를 받고, 전송할 때는 base64 |
threshold | number | 0.9 | 얼마나 비슷해야 찾은 것으로 볼지, 0에서 1 |
region | list<int> | 이 영역 안에서만 찾기. 화면 픽셀 기준 왼쪽, 위, 오른쪽, 아래 순서. 더 빠르고 영역 밖은 맞지 않음 | |
scales | list<number> | 시도할 그림 크기. 1이 잘라낸 크기 그대로이며, 화면 밀도가 다른 폰이면 0.8, 1, 1.25처럼. 크기마다 시간이 더 걸림 | |
color | bool | false | 평균 색도 같아야 맞은 것으로 봄. 모양이 같은 빨간 버튼과 초록 버튼을 구분할 때 |
반환: 다음 타입의 값: bool
에러: NO_PERMISSION
find_images
화면에서 그림이 나오는 곳 전부
timeout을 주지 않으면 바로 답하고, 맞는 것이 없으면 빈 목록입니다. 잘 맞는 순서로 오며 서로 겹치지 않습니다. PC에서 실행되며, 화면 밀도가 다른 폰에서는 scales를 넘기세요
PC에서 실행됩니다. 서버가 폰에서 스크린샷을 받고 폰을 통해 탭합니다.
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
image | image | 필수 | 찾을 대상의 PNG나 JPEG. 같은 폰의 스크린샷에서 잘라낸 것. SDK와 CLI는 파일 경로를 받고, 전송할 때는 base64 |
threshold | number | 0.9 | 얼마나 비슷해야 찾은 것으로 볼지, 0에서 1 |
timeout | number | 0 s | 하나라도 뜰 때까지 기다리는 초. 0이면 바로 답함 |
region | list<int> | 이 영역 안에서만 찾기. 화면 픽셀 기준 왼쪽, 위, 오른쪽, 아래 순서. 더 빠르고 영역 밖은 맞지 않음 | |
scales | list<number> | 시도할 그림 크기. 1이 잘라낸 크기 그대로이며, 화면 밀도가 다른 폰이면 0.8, 1, 1.25처럼. 크기마다 시간이 더 걸림 | |
color | bool | false | 평균 색도 같아야 맞은 것으로 봄. 모양이 같은 빨간 버튼과 초록 버튼을 구분할 때 |
max | int | 20 | 돌려줄 최대 개수 |
반환: 다음 타입의 값: list<image_match>
에러: NO_PERMISSION
wait_image_gone
그림이 화면에서 사라질 때까지 대기
선택 기능이며 PC에서 실행됩니다. 서버가 스크린샷을 받아 비교합니다. 같은 폰의 스크린샷에서 잘라 쓰고, 화면 밀도가 다른 폰에서는 scales를 넘기세요. Android 9, 10에서는 화면 캡처 허용이 필요합니다
PC에서 실행됩니다. 서버가 폰에서 스크린샷을 받고 폰을 통해 탭합니다.
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
image | image | 필수 | 찾을 대상의 PNG나 JPEG. 같은 폰의 스크린샷에서 잘라낸 것. SDK와 CLI는 파일 경로를 받고, 전송할 때는 base64 |
threshold | number | 0.9 | 얼마나 비슷해야 찾은 것으로 볼지, 0에서 1 |
timeout | number | 10 s | 대상이 뜰 때까지 기다리는 초 |
region | list<int> | 이 영역 안에서만 찾기. 화면 픽셀 기준 왼쪽, 위, 오른쪽, 아래 순서. 더 빠르고 영역 밖은 맞지 않음 | |
scales | list<number> | 시도할 그림 크기. 1이 잘라낸 크기 그대로이며, 화면 밀도가 다른 폰이면 0.8, 1, 1.25처럼. 크기마다 시간이 더 걸림 | |
color | bool | false | 평균 색도 같아야 맞은 것으로 봄. 모양이 같은 빨간 버튼과 초록 버튼을 구분할 때 |
반환: 다음 필드를 가진 객체: ms
에러: TIMEOUT, NO_PERMISSION
ocr
OCR로 화면의 글자 읽기
선택 기능이며 PC의 Tesseract로 실행됩니다. Tesseract와 필요한 언어 데이터는 직접 설치해야 하며, 자동으로 설치되지 않습니다. Android 9, 10에서는 화면 캡처 허용이 필요합니다
PC에서 실행됩니다. 서버가 폰에서 스크린샷을 받고 폰을 통해 탭합니다.
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
lang | string | "eng" | Tesseract 언어, 예: kor+eng. 각 언어 데이터가 설치돼 있어야 함 |
반환: 다음 필드를 가진 객체: text, lines
에러: OCR_UNAVAILABLE, NO_PERMISSION
d.ocr("kor+eng")await d.ocr("kor+eng");await d.OcrAsync("kor+eng");droidline ocr kor+engcurl -s -X POST localhost:8780/devices/_/ocr \
-H 'content-type: application/json' \
-d '{"lang":"kor+eng"}'{"id":1,"cmd":"ocr","lang":"kor+eng"}ocr_find
OCR로 화면에서 글자가 보일 때까지 기다렸다가 위치를 반환
선택 기능이며 PC의 Tesseract로 실행됩니다. Tesseract와 필요한 언어 데이터는 직접 설치해야 하며, 자동으로 설치되지 않습니다. Android 9, 10에서는 화면 캡처 허용이 필요합니다
PC에서 실행됩니다. 서버가 폰에서 스크린샷을 받고 폰을 통해 탭합니다.
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
text | string | 필수 | 찾을 글자: 단어 하나 전체, 또는 줄의 일부 |
lang | string | "eng" | Tesseract 언어, 예: kor+eng. 각 언어 데이터가 설치돼 있어야 함 |
timeout | number | 10 s | 대상이 뜰 때까지 기다리는 초 |
반환: 다음 필드를 가진 객체: text, x, y, bounds
에러: NOT_FOUND, OCR_UNAVAILABLE, NO_PERMISSION
d.ocr_find("다음", "kor+eng")await d.ocrFind("다음", "kor+eng");await d.OcrFindAsync("다음", "kor+eng");droidline ocr_find "다음" kor+engcurl -s -X POST localhost:8780/devices/_/ocr_find \
-H 'content-type: application/json' \
-d '{"text":"다음","lang":"kor+eng"}'{"id":1,"cmd":"ocr_find","text":"다음","lang":"kor+eng"}ocr_tap
OCR로 화면에서 글자가 보일 때까지 기다렸다가 누르기
선택 기능이며 PC의 Tesseract로 실행됩니다. Tesseract와 필요한 언어 데이터는 직접 설치해야 하며, 자동으로 설치되지 않습니다. Android 9, 10에서는 화면 캡처 허용이 필요합니다
PC에서 실행됩니다. 서버가 폰에서 스크린샷을 받고 폰을 통해 탭합니다.
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
text | string | 필수 | 찾을 글자: 단어 하나 전체, 또는 줄의 일부 |
lang | string | "eng" | Tesseract 언어, 예: kor+eng. 각 언어 데이터가 설치돼 있어야 함 |
timeout | number | 10 s | 대상이 뜰 때까지 기다리는 초 |
반환: 다음 필드를 가진 객체: text, x, y, ms
에러: NOT_FOUND, OCR_UNAVAILABLE, NO_PERMISSION
d.ocr_tap("시작", "kor+eng")await d.ocrTap("시작", "kor+eng");await d.OcrTapAsync("시작", "kor+eng");droidline ocr_tap "시작" kor+engcurl -s -X POST localhost:8780/devices/_/ocr_tap \
-H 'content-type: application/json' \
-d '{"text":"시작","lang":"kor+eng"}'{"id":1,"cmd":"ocr_tap","text":"시작","lang":"kor+eng"}current
지금 떠 있는 패키지명과 액티비티명
반환: 다음 필드를 가진 객체: package, activity
d.current()await d.current();await d.CurrentAsync();droidline currentcurl -s -X POST localhost:8780/devices/_/current \
-H 'content-type: application/json'{"id":1,"cmd":"current"}좌표
tap
좌표 탭
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
x | int | 필수 | 화면 픽셀 X |
y | int | 필수 | 화면 픽셀 Y |
반환: 다음 필드를 가진 객체: ms
d.tap(540, 1200)await d.tap(540, 1200);await d.TapAsync(540, 1200);droidline tap 540 1200curl -s -X POST localhost:8780/devices/_/tap \
-H 'content-type: application/json' \
-d '{"x":540,"y":1200}'{"id":1,"cmd":"tap","x":540,"y":1200}long_tap
좌표 길게 누르기
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
x | int | 필수 | 화면 픽셀 X |
y | int | 필수 | 화면 픽셀 Y |
ms | int | 800 | 누르는 시간(ms) |
반환: 다음 필드를 가진 객체: ms
d.long_tap(540, 1200, 800)await d.longTap(540, 1200, 800);await d.LongTapAsync(540, 1200, 800);droidline long_tap 540 1200 800curl -s -X POST localhost:8780/devices/_/long_tap \
-H 'content-type: application/json' \
-d '{"x":540,"y":1200,"ms":800}'{"id":1,"cmd":"long_tap","x":540,"y":1200,"ms":800}swipe
두 좌표 사이 또는 방향으로 스와이프
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
x1 | int|string | 필수 | 시작 X 또는 방향: up, down, left, right |
y1 | int | 시작 Y | |
x2 | int | 끝 X | |
y2 | int | 끝 Y | |
ms | int | 300 | 시간(ms) |
반환: 다음 필드를 가진 객체: ms
d.swipe(540, 1600, 540, 400, 300)await d.swipe(540, 1600, 540, 400, 300);await d.SwipeAsync(540, 1600, 540, 400, 300);droidline swipe 540 1600 540 400 300curl -s -X POST localhost:8780/devices/_/swipe \
-H 'content-type: application/json' \
-d '{"x1":540,"y1":1600,"x2":540,"y2":400,"ms":300}'{"id":1,"cmd":"swipe","x1":540,"y1":1600,"x2":540,"y2":400,"ms":300}요소
touch
대상이 뜰 때까지 기다렸다가 누르기
노드 클릭이 거부되면 bounds 중심을 좌표 탭. via에 node, parent, gesture 중 성공한 경로 표시
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
by | selector | 필수 | 어느 dump 속성으로 찾을지(text, textContains, textMatches, id, desc, descContains, descMatches, class), 또는 조건 여러 개를 담은 쿼리 객체 |
value | string | 찾을 값. by가 쿼리 객체이면 생략 | |
nth | int | 0 | 같은 대상이 여럿일 때 순번, 0부터 |
timeout | number | 10 s | 대상이 뜰 때까지 기다리는 초 |
반환: 다음 필드를 가진 객체: via, ms
줄임 이름: touchById(value), touchByText(value), touchByDesc(value)
에러: NOT_FOUND, NOT_CLICKABLE, NO_ACCESSIBILITY
d.touch("text", "로그인")await d.touch("text", "로그인");await d.TouchAsync("text", "로그인");droidline touch text "로그인"curl -s -X POST localhost:8780/devices/_/touch \
-H 'content-type: application/json' \
-d '{"by":"text","value":"로그인"}'{"id":1,"cmd":"touch","by":"text","value":"로그인"}long_touch
대상을 기다렸다가 길게 누르기
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
by | selector | 필수 | 어느 dump 속성으로 찾을지(text, textContains, textMatches, id, desc, descContains, descMatches, class), 또는 조건 여러 개를 담은 쿼리 객체 |
value | string | 찾을 값. by가 쿼리 객체이면 생략 | |
ms | int | 800 | 누르는 시간(ms) |
nth | int | 0 | 같은 대상이 여럿일 때 순번, 0부터 |
timeout | number | 10 s | 대상이 뜰 때까지 기다리는 초 |
반환: 다음 필드를 가진 객체: via, ms
d.long_touch("text", "메시지")await d.longTouch("text", "메시지");await d.LongTouchAsync("text", "메시지");droidline long_touch text "메시지"curl -s -X POST localhost:8780/devices/_/long_touch \
-H 'content-type: application/json' \
-d '{"by":"text","value":"메시지"}'{"id":1,"cmd":"long_touch","by":"text","value":"메시지"}scroll_to
대상이 보일 때까지 스크롤
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
by | selector | 필수 | 어느 dump 속성으로 찾을지(text, textContains, textMatches, id, desc, descContains, descMatches, class), 또는 조건 여러 개를 담은 쿼리 객체 |
value | string | 찾을 값. by가 쿼리 객체이면 생략 | |
direction | string down | up | left | right | "down" | 스크롤 방향 |
max_swipes | int | 20 | 이만큼 스와이프해도 없으면 포기 |
nth | int | 0 | 같은 대상이 여럿일 때 순번, 0부터 |
반환: 다음 필드를 가진 객체: swipes
d.scroll_to("text", "설정")await d.scrollTo("text", "설정");await d.ScrollToAsync("text", "설정");droidline scroll_to text "설정"curl -s -X POST localhost:8780/devices/_/scroll_to \
-H 'content-type: application/json' \
-d '{"by":"text","value":"설정"}'{"id":1,"cmd":"scroll_to","by":"text","value":"설정"}입력
input
입력칸을 기다렸다가 글자 넣기
접근성 글자 설정 동작을 쓰고, 이를 무시하는 칸은 자체 키보드가 선택돼 있으면 키보드로 입력
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
by | selector | 필수 | 어느 dump 속성으로 찾을지(text, textContains, textMatches, id, desc, descContains, descMatches, class), 또는 조건 여러 개를 담은 쿼리 객체 |
value | string | 찾을 값. by가 쿼리 객체이면 생략 | |
text | string | 필수 | 넣을 글자 |
append | bool | false | 기존 글자 뒤에 이어 붙이기 |
nth | int | 0 | 같은 대상이 여럿일 때 순번, 0부터 |
timeout | number | 10 s | 대상이 뜰 때까지 기다리는 초 |
반환: 다음 필드를 가진 객체: via, ms
d.input("id", "email", "me@example.com")await d.input("id", "email", "me@example.com");await d.InputAsync("id", "email", "me@example.com");droidline input id email me@example.comcurl -s -X POST localhost:8780/devices/_/input \
-H 'content-type: application/json' \
-d '{"by":"id","value":"email","text":"me@example.com"}'{"id":1,"cmd":"input","by":"id","value":"email","text":"me@example.com"}clear
입력칸 비우기
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
by | selector | 필수 | 어느 dump 속성으로 찾을지(text, textContains, textMatches, id, desc, descContains, descMatches, class), 또는 조건 여러 개를 담은 쿼리 객체 |
value | string | 찾을 값. by가 쿼리 객체이면 생략 | |
nth | int | 0 | 같은 대상이 여럿일 때 순번, 0부터 |
timeout | number | 10 s | 대상이 뜰 때까지 기다리는 초 |
반환: 다음 필드를 가진 객체: ms
d.clear("id", "email")await d.clear("id", "email");await d.ClearAsync("id", "email");droidline clear id emailcurl -s -X POST localhost:8780/devices/_/clear \
-H 'content-type: application/json' \
-d '{"by":"id","value":"email"}'{"id":1,"cmd":"clear","by":"id","value":"email"}sendkey
키 이름, 키코드, 또는 글자 보내기
back, home, recents, notifications, quick_settings, lock은 접근성 전역 동작. 그 외 키와 글자는 자체 키보드로 포커스된 칸에 전송
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
key | string|int | 키 이름(enter, tab, del, space, escape, up, down, left, right, back, home 등), 안드로이드 키코드, 또는 입력할 글자 | |
text | string | 키 이름과 같아도 글자 그대로 입력 |
반환: 다음 필드를 가진 객체: via
d.sendkey("enter")await d.sendkey("enter");await d.SendkeyAsync("enter");droidline sendkey entercurl -s -X POST localhost:8780/devices/_/sendkey \
-H 'content-type: application/json' \
-d '{"key":"enter"}'{"id":1,"cmd":"sendkey","key":"enter"}확인
existswaitwait_gonewait_idlefindfind_allget_text
exists
지금 화면에 대상이 있는지. 기다리지 않음
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
by | selector | 필수 | 어느 dump 속성으로 찾을지(text, textContains, textMatches, id, desc, descContains, descMatches, class), 또는 조건 여러 개를 담은 쿼리 객체 |
value | string | 찾을 값. by가 쿼리 객체이면 생략 | |
nth | int | 0 | 같은 대상이 여럿일 때 순번, 0부터 |
반환: 다음 타입의 값: bool
d.exists("text", "광고 닫기")await d.exists("text", "광고 닫기");await d.ExistsAsync("text", "광고 닫기");droidline exists text "광고 닫기"curl -s -X POST localhost:8780/devices/_/exists \
-H 'content-type: application/json' \
-d '{"by":"text","value":"광고 닫기"}'{"id":1,"cmd":"exists","by":"text","value":"광고 닫기"}wait
대상이 뜰 때까지 대기
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
by | selector | 필수 | 어느 dump 속성으로 찾을지(text, textContains, textMatches, id, desc, descContains, descMatches, class), 또는 조건 여러 개를 담은 쿼리 객체 |
value | string | 찾을 값. by가 쿼리 객체이면 생략 | |
timeout | number | 10 s | 대상이 뜰 때까지 기다리는 초 |
nth | int | 0 | 같은 대상이 여럿일 때 순번, 0부터 |
반환: 다음 필드를 가진 객체: ms
에러: NOT_FOUND
d.wait("text", "완료", timeout=30)await d.wait("text", "완료", { timeout: 30 });await d.WaitAsync("text", "완료", timeout: 30);droidline wait text "완료" --timeout 30curl -s -X POST localhost:8780/devices/_/wait \
-H 'content-type: application/json' \
-d '{"by":"text","value":"완료","timeout":30}'{"id":1,"cmd":"wait","by":"text","value":"완료","timeout":30}wait_gone
대상이 사라질 때까지 대기
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
by | selector | 필수 | 어느 dump 속성으로 찾을지(text, textContains, textMatches, id, desc, descContains, descMatches, class), 또는 조건 여러 개를 담은 쿼리 객체 |
value | string | 찾을 값. by가 쿼리 객체이면 생략 | |
timeout | number | 10 s | 대상이 뜰 때까지 기다리는 초 |
반환: 다음 필드를 가진 객체: ms
에러: TIMEOUT
d.wait_gone("text", "불러오는 중")await d.waitGone("text", "불러오는 중");await d.WaitGoneAsync("text", "불러오는 중");droidline wait_gone text "불러오는 중"curl -s -X POST localhost:8780/devices/_/wait_gone \
-H 'content-type: application/json' \
-d '{"by":"text","value":"불러오는 중"}'{"id":1,"cmd":"wait_gone","by":"text","value":"불러오는 중"}wait_idle
화면이 더 바뀌지 않을 때까지 대기
앞에 있는 앱이 ms 밀리초 동안 새로 그린 것이 없을 때까지 기다립니다. 내용을 불러오는 동작 뒤에 고정된 sleep 대신 쓰세요. 계속 움직이는 화면에서는 TIMEOUT으로 끝납니다
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
ms | int | 500 ms | 화면이 그대로 있어야 하는 시간 |
timeout | number | 10 s | 포기하기 전까지 기다리는 초 |
반환: 다음 필드를 가진 객체: ms
에러: TIMEOUT
d.wait_idle()await d.waitIdle();await d.WaitIdleAsync();droidline wait_idlecurl -s -X POST localhost:8780/devices/_/wait_idle \
-H 'content-type: application/json'{"id":1,"cmd":"wait_idle"}find
대상이 뜰 때까지 기다렸다가 그 요소를 반환
SDK는 click, input, find와 노드 속성을 가진 요소 객체를 돌려줍니다. 노드에 children은 없습니다
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
by | selector | 필수 | 어느 dump 속성으로 찾을지(text, textContains, textMatches, id, desc, descContains, descMatches, class), 또는 조건 여러 개를 담은 쿼리 객체 |
value | string | 찾을 값. by가 쿼리 객체이면 생략 | |
nth | int | 0 | 같은 대상이 여럿일 때 순번, 0부터 |
timeout | number | 10 s | 대상이 뜰 때까지 기다리는 초 |
반환: 다음 타입의 값: node
에러: NOT_FOUND
d.find("text", "로그인")await d.find("text", "로그인");await d.FindAsync("text", "로그인");droidline find text "로그인"curl -s -X POST localhost:8780/devices/_/find \
-H 'content-type: application/json' \
-d '{"by":"text","value":"로그인"}'{"id":1,"cmd":"find","by":"text","value":"로그인"}find_all
지금 조건에 맞는 요소 전부
timeout을 주지 않으면 바로 답하고, 맞는 것이 없으면 빈 목록입니다. 방향 쿼리는 가까운 순서로 옵니다
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
by | selector | 필수 | 어느 dump 속성으로 찾을지(text, textContains, textMatches, id, desc, descContains, descMatches, class), 또는 조건 여러 개를 담은 쿼리 객체 |
value | string | 찾을 값. by가 쿼리 객체이면 생략 | |
timeout | number | 0 s | 하나라도 뜰 때까지 기다리는 초. 0이면 바로 답함 |
반환: 다음 타입의 값: list<node>
d.find_all("id", "title")await d.findAll("id", "title");await d.FindAllAsync("id", "title");droidline find_all id titlecurl -s -X POST localhost:8780/devices/_/find_all \
-H 'content-type: application/json' \
-d '{"by":"id","value":"title"}'{"id":1,"cmd":"find_all","by":"id","value":"title"}get_text
대상의 글자, 없으면 빈 문자열
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
by | selector | 필수 | 어느 dump 속성으로 찾을지(text, textContains, textMatches, id, desc, descContains, descMatches, class), 또는 조건 여러 개를 담은 쿼리 객체 |
value | string | 찾을 값. by가 쿼리 객체이면 생략 | |
nth | int | 0 | 같은 대상이 여럿일 때 순번, 0부터 |
반환: 다음 타입의 값: string
d.get_text("id", "balance")await d.getText("id", "balance");await d.GetTextAsync("id", "balance");droidline get_text id balancecurl -s -X POST localhost:8780/devices/_/get_text \
-H 'content-type: application/json' \
-d '{"by":"id","value":"balance"}'{"id":1,"cmd":"get_text","by":"id","value":"balance"}조건
checkedenabledselectedcountwhichin_appkeyboard_shownlast_toastcolor
checked
스위치·체크박스가 켜져 있으면 true
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
by | selector | 필수 | 어느 dump 속성으로 찾을지(text, textContains, textMatches, id, desc, descContains, descMatches, class), 또는 조건 여러 개를 담은 쿼리 객체 |
value | string | 찾을 값. by가 쿼리 객체이면 생략 | |
nth | int | 0 | 같은 대상이 여럿일 때 순번, 0부터 |
반환: 다음 타입의 값: bool
d.checked("id", "auto_login")await d.checked("id", "auto_login");await d.CheckedAsync("id", "auto_login");droidline checked id auto_logincurl -s -X POST localhost:8780/devices/_/checked \
-H 'content-type: application/json' \
-d '{"by":"id","value":"auto_login"}'{"id":1,"cmd":"checked","by":"id","value":"auto_login"}enabled
버튼이 눌릴 수 있는 상태면 true
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
by | selector | 필수 | 어느 dump 속성으로 찾을지(text, textContains, textMatches, id, desc, descContains, descMatches, class), 또는 조건 여러 개를 담은 쿼리 객체 |
value | string | 찾을 값. by가 쿼리 객체이면 생략 | |
nth | int | 0 | 같은 대상이 여럿일 때 순번, 0부터 |
반환: 다음 타입의 값: bool
d.enabled("text", "다음")await d.enabled("text", "다음");await d.EnabledAsync("text", "다음");droidline enabled text "다음"curl -s -X POST localhost:8780/devices/_/enabled \
-H 'content-type: application/json' \
-d '{"by":"text","value":"다음"}'{"id":1,"cmd":"enabled","by":"text","value":"다음"}selected
탭이 선택된 상태면 true
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
by | selector | 필수 | 어느 dump 속성으로 찾을지(text, textContains, textMatches, id, desc, descContains, descMatches, class), 또는 조건 여러 개를 담은 쿼리 객체 |
value | string | 찾을 값. by가 쿼리 객체이면 생략 | |
nth | int | 0 | 같은 대상이 여럿일 때 순번, 0부터 |
반환: 다음 타입의 값: bool
d.selected("text", "홈")await d.selected("text", "홈");await d.SelectedAsync("text", "홈");droidline selected text "홈"curl -s -X POST localhost:8780/devices/_/selected \
-H 'content-type: application/json' \
-d '{"by":"text","value":"홈"}'{"id":1,"cmd":"selected","by":"text","value":"홈"}count
조건에 맞는 요소 개수
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
by | selector | 필수 | 어느 dump 속성으로 찾을지(text, textContains, textMatches, id, desc, descContains, descMatches, class), 또는 조건 여러 개를 담은 쿼리 객체 |
value | string | 찾을 값. by가 쿼리 객체이면 생략 |
반환: 다음 타입의 값: int
d.count("class", "android.widget.CheckBox")await d.count("class", "android.widget.CheckBox");await d.CountAsync("class", "android.widget.CheckBox");droidline count class android.widget.CheckBoxcurl -s -X POST localhost:8780/devices/_/count \
-H 'content-type: application/json' \
-d '{"by":"class","value":"android.widget.CheckBox"}'{"id":1,"cmd":"count","by":"class","value":"android.widget.CheckBox"}which
여러 후보 중 먼저 나타난 것의 순번, 없으면 -1
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
candidates | list<selector_pair> | 필수 | [속성, 값] 쌍이나 쿼리 객체의 목록 |
timeout | number | 10 s | 후보가 뜰 때까지 기다리는 초 |
반환: 다음 타입의 값: int
d.which([("text", "로그인"), ("id", "main_tab")], timeout=15)await d.which([["text", "로그인"], ["id", "main_tab"]], { timeout: 15 });await d.WhichAsync(new object[] { ("text", "로그인"), ("id", "main_tab") }, timeout: 15);droidline which text="로그인" id=main_tab --timeout 15curl -s -X POST localhost:8780/devices/_/which \
-H 'content-type: application/json' \
-d '{"candidates":[["text","로그인"],["id","main_tab"]],"timeout":15}'{"id":1,"cmd":"which","candidates":[["text","로그인"],["id","main_tab"]],"timeout":15}in_app
지금 그 앱이 앞에 떠 있으면 true
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
package | string | 필수 | 패키지명, 예: com.android.chrome |
반환: 다음 타입의 값: bool
d.in_app("com.android.chrome")await d.inApp("com.android.chrome");await d.InAppAsync("com.android.chrome");droidline in_app com.android.chromecurl -s -X POST localhost:8780/devices/_/in_app \
-H 'content-type: application/json' \
-d '{"package":"com.android.chrome"}'{"id":1,"cmd":"in_app","package":"com.android.chrome"}keyboard_shown
키보드가 올라와 있으면 true
반환: 다음 타입의 값: bool
d.keyboard_shown()await d.keyboardShown();await d.KeyboardShownAsync();droidline keyboard_showncurl -s -X POST localhost:8780/devices/_/keyboard_shown \
-H 'content-type: application/json'{"id":1,"cmd":"keyboard_shown"}last_toast
최근 토스트 메시지 글자, 없으면 빈 문자열
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
max_age | number | 30 s | 이 초보다 오래된 토스트는 무시 |
반환: 다음 타입의 값: string
d.last_toast()await d.lastToast();await d.LastToastAsync();droidline last_toastcurl -s -X POST localhost:8780/devices/_/last_toast \
-H 'content-type: application/json'{"id":1,"cmd":"last_toast"}color
해당 좌표의 색(#RRGGBB)
노드가 없는 화면(게임 등) 분기용
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
x | int | 필수 | 화면 픽셀 X |
y | int | 필수 | 화면 픽셀 Y |
반환: 다음 타입의 값: string
d.color(540, 1200)await d.color(540, 1200);await d.ColorAsync(540, 1200);droidline color 540 1200curl -s -X POST localhost:8780/devices/_/color \
-H 'content-type: application/json' \
-d '{"x":540,"y":1200}'{"id":1,"cmd":"color","x":540,"y":1200}기기
screen_onlockedwakelockbatteryorientationinfo
screen_on
화면이 켜져 있으면 true
반환: 다음 타입의 값: bool
d.screen_on()await d.screenOn();await d.ScreenOnAsync();droidline screen_oncurl -s -X POST localhost:8780/devices/_/screen_on \
-H 'content-type: application/json'{"id":1,"cmd":"screen_on"}locked
잠금 화면이면 true
반환: 다음 타입의 값: bool
d.locked()await d.locked();await d.LockedAsync();droidline lockedcurl -s -X POST localhost:8780/devices/_/locked \
-H 'content-type: application/json'{"id":1,"cmd":"locked"}wake
화면을 켜고, PIN이 없는 잠금 화면은 해제
화면이 꺼져 있으면 제스처가 실패합니다. PIN·패턴·비밀번호 잠금은 사람이 풀어야 합니다
반환: 다음 필드를 가진 객체: screen_on, locked
d.wake()await d.wake();await d.WakeAsync();droidline wakecurl -s -X POST localhost:8780/devices/_/wake \
-H 'content-type: application/json'{"id":1,"cmd":"wake"}lock
화면 끄고 잠그기
반환: 없음
d.lock()await d.lock();await d.LockAsync();droidline lockcurl -s -X POST localhost:8780/devices/_/lock \
-H 'content-type: application/json'{"id":1,"cmd":"lock"}battery
배터리 잔량, 충전 중 여부
반환: 다음 필드를 가진 객체: level, charging, temperature
d.battery()await d.battery();await d.BatteryAsync();droidline batterycurl -s -X POST localhost:8780/devices/_/battery \
-H 'content-type: application/json'{"id":1,"cmd":"battery"}orientation
화면 방향: portrait 또는 landscape
반환: 다음 타입의 값: string
d.orientation()await d.orientation();await d.OrientationAsync();droidline orientationcurl -s -X POST localhost:8780/devices/_/orientation \
-H 'content-type: application/json'{"id":1,"cmd":"orientation"}info
모델, 안드로이드 버전, 화면 크기, 권한 준비 상태
반환: 다음 필드를 가진 객체: model, manufacturer, sdk, release, agent, width, height, ready
d.info()await d.info();await d.InfoAsync();droidline infocurl -s -X POST localhost:8780/devices/_/info \
-H 'content-type: application/json'{"id":1,"cmd":"info"}네트워크
network
연결 종류(wifi, mobile, none)와 비행기 모드 여부
반환: 다음 필드를 가진 객체: type, airplane, metered
d.network()await d.network();await d.NetworkAsync();droidline networkcurl -s -X POST localhost:8780/devices/_/network \
-H 'content-type: application/json'{"id":1,"cmd":"network"}proxy
앱별 VPN으로 고른 앱만 업스트림 프록시로 보내기
http://(CONNECT)와 socks5://, user:pass 인증 지원. null이나 "off"로 끔. 업스트림은 한 번에 하나. 프록시 설정을 무시하는 앱은 새지 않고 연결이 막힘
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
url | string|null | 필수 | socks5://user:pass@host:port, http://host:port, @kr1 같은 저장된 프로필, 또는 off |
app | string|list<string> | 프록시로 보낼 패키지(여러 개 가능) |
반환: 다음 필드를 가진 객체: active, apps
에러: NO_PERMISSION, PROXY_FAILED, UNSUPPORTED
d.proxy("@kr1", app="com.android.chrome")await d.proxy("@kr1", { app: "com.android.chrome" });await d.ProxyAsync("@kr1", app: "com.android.chrome");droidline proxy @kr1 --app com.android.chromecurl -s -X POST localhost:8780/devices/_/proxy \
-H 'content-type: application/json' \
-d '{"url":"@kr1","app":"com.android.chrome"}'{"id":1,"cmd":"proxy","url":"@kr1","app":"com.android.chrome"}proxy_check
앱별 프록시 연결 상태와 바깥에서 보이는 IP
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
app | string | 확인할 패키지 |
반환: 다음 필드를 가진 객체: active, ip, upstream, error
d.proxy_check("com.android.chrome")await d.proxyCheck("com.android.chrome");await d.ProxyCheckAsync("com.android.chrome");droidline proxy_check com.android.chromecurl -s -X POST localhost:8780/devices/_/proxy_check \
-H 'content-type: application/json' \
-d '{"app":"com.android.chrome"}'{"id":1,"cmd":"proxy_check","app":"com.android.chrome"}앱
launchopen_urlintentclear_dataappsinstalled
launch
앱 실행, 선택적으로 특정 액티비티
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
package | string | 필수 | 패키지명, 예: com.android.chrome |
activity | string | 액티비티명, 전체 이름 또는 점으로 시작 |
반환: 다음 필드를 가진 객체: ms
에러: APP_NOT_FOUND, ACTIVITY_BLOCKED
d.launch("com.android.settings")await d.launch("com.android.settings");await d.LaunchAsync("com.android.settings");droidline launch com.android.settingscurl -s -X POST localhost:8780/devices/_/launch \
-H 'content-type: application/json' \
-d '{"package":"com.android.settings"}'{"id":1,"cmd":"launch","package":"com.android.settings"}open_url
URL이나 딥링크 열기
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
url | string | 필수 | http(s) 주소 또는 앱 딥링크 |
package | string | 이 앱으로만 열기 |
반환: 없음
d.open_url("https://droidline.dev")await d.openUrl("https://droidline.dev");await d.OpenUrlAsync("https://droidline.dev");droidline open_url https://droidline.devcurl -s -X POST localhost:8780/devices/_/open_url \
-H 'content-type: application/json' \
-d '{"url":"https://droidline.dev"}'{"id":1,"cmd":"open_url","url":"https://droidline.dev"}intent
인텐트 액션으로 화면 열기 (설정 화면 등)
다른 앱이 열 수 있는 화면이면 무엇이든 엽니다. 예: android.settings.WIFI_SETTINGS, 또는 data를 package:com.example로 준 android.settings.APPLICATION_DETAILS_SETTINGS. 화면은 새로 열리며, 같은 앱의 다른 화면은 닫힙니다. 그다음 무엇을 눌러야 하는지는 제조사와 언어마다 달라서, 와이파이, 비행기 모드, 강제 종료, 데이터 삭제는 명령 대신 문서의 예제로 제공합니다
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
action | string | 필수 | 인텐트 액션. 예: android.settings.WIFI_SETTINGS |
data | string | 데이터 URI. 예: package:com.example | |
package | string | 이 앱만 처리하게 함 |
반환: 없음
에러: APP_NOT_FOUND, BAD_ARGS
d.intent("android.settings.WIFI_SETTINGS")await d.intent("android.settings.WIFI_SETTINGS");await d.IntentAsync("android.settings.WIFI_SETTINGS");droidline intent android.settings.WIFI_SETTINGScurl -s -X POST localhost:8780/devices/_/intent \
-H 'content-type: application/json' \
-d '{"action":"android.settings.WIFI_SETTINGS"}'{"id":1,"cmd":"intent","action":"android.settings.WIFI_SETTINGS"}clear_data
기기 소유자 모드에서 앱 데이터 삭제
선택 기능이며 기기 소유자 모드에서만 동작합니다. 설정 화면을 열지 않고 폰이 바로 지웁니다. 이 모드가 아니면 NO_PERMISSION으로 답하며, 설정 화면을 거치는 방법은 문서의 예제에 있습니다
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
package | string | 필수 | 패키지명, 예: com.android.chrome |
반환: 다음 필드를 가진 객체: ms
에러: APP_NOT_FOUND, NO_PERMISSION
d.clear_data("com.android.chrome")await d.clearData("com.android.chrome");await d.ClearDataAsync("com.android.chrome");droidline clear_data com.android.chromecurl -s -X POST localhost:8780/devices/_/clear_data \
-H 'content-type: application/json' \
-d '{"package":"com.android.chrome"}'{"id":1,"cmd":"clear_data","package":"com.android.chrome"}apps
설치된 패키지 목록
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
system | bool | false | 시스템 패키지 포함 |
반환: 다음 타입의 값: list<app>
d.apps()await d.apps();await d.AppsAsync();droidline appscurl -s -X POST localhost:8780/devices/_/apps \
-H 'content-type: application/json'{"id":1,"cmd":"apps"}installed
설치돼 있으면 버전명, 아니면 빈 문자열
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
package | string | 필수 | 패키지명, 예: com.android.chrome |
반환: 다음 타입의 값: string
d.installed("com.android.chrome")await d.installed("com.android.chrome");await d.InstalledAsync("com.android.chrome");droidline installed com.android.chromecurl -s -X POST localhost:8780/devices/_/installed \
-H 'content-type: application/json' \
-d '{"package":"com.android.chrome"}'{"id":1,"cmd":"installed","package":"com.android.chrome"}시스템
backhomerecentsopen_notificationsquick_settingsclipboardbatch
back
뒤로
반환: 없음
d.back()await d.back();await d.BackAsync();droidline backcurl -s -X POST localhost:8780/devices/_/back \
-H 'content-type: application/json'{"id":1,"cmd":"back"}home
홈 화면
반환: 없음
d.home()await d.home();await d.HomeAsync();droidline homecurl -s -X POST localhost:8780/devices/_/home \
-H 'content-type: application/json'{"id":1,"cmd":"home"}recents
최근 앱
반환: 없음
d.recents()await d.recents();await d.RecentsAsync();droidline recentscurl -s -X POST localhost:8780/devices/_/recents \
-H 'content-type: application/json'{"id":1,"cmd":"recents"}open_notifications
알림창 내리기
반환: 없음
d.open_notifications()await d.openNotifications();await d.OpenNotificationsAsync();droidline open_notificationscurl -s -X POST localhost:8780/devices/_/open_notifications \
-H 'content-type: application/json'{"id":1,"cmd":"open_notifications"}quick_settings
빠른 설정 열기
반환: 없음
d.quick_settings()await d.quickSettings();await d.QuickSettingsAsync();droidline quick_settingscurl -s -X POST localhost:8780/devices/_/quick_settings \
-H 'content-type: application/json'{"id":1,"cmd":"quick_settings"}clipboard
클립보드 쓰기, 글자 없이 부르면 읽기
Android 10 이상에서 읽기는 자체 키보드가 현재 입력기여야 가능
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
text | string | 복사할 글. 생략하면 읽기 |
반환: 다음 타입의 값: string
에러: NO_IME
d.clipboard("안녕하세요")await d.clipboard("안녕하세요");await d.ClipboardAsync("안녕하세요");droidline clipboard "안녕하세요"curl -s -X POST localhost:8780/devices/_/clipboard \
-H 'content-type: application/json' \
-d '{"text":"안녕하세요"}'{"id":1,"cmd":"clipboard","text":"안녕하세요"}batch
여러 명령을 폰에서 한 번에 실행, 끊긴 동안에도 계속
단계는 [명령, 인자...] 목록이나 {cmd, ...} 객체. sleep(ms)는 batch 안에서만 씀. 와이파이를 껐다 켜는 것처럼 단계가 폰의 네트워크를 끊으면 cuts_network를 넘기세요. 폰이 accepted로 먼저 답하고, 끊긴 동안 단계를 실행한 뒤 재접속하면 결과가 옴
cuts_network를 줄 때 accepted 대신 최종 결과를 받으려면 wait를 함께 주세요.
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
steps | list<step> | 필수 | 순서대로 실행할 명령 |
stop_on_error | bool | true | 실패한 단계에서 멈춤 |
cuts_network | bool | false | 단계가 폰의 연결을 끊음. accepted로 먼저 답하고 재접속 후 결과를 보냄 |
반환: 다음 필드를 가진 객체: results
d.batch([("home",), ("sleep", 500), ("recents",)])await d.batch([["home"], ["sleep", 500], ["recents"]]);await d.BatchAsync(new object[] { new object[] { "home" }, ("sleep", 500), new object[] { "recents" } });droidline batch '[["home"],["sleep",500],["recents"]]'curl -s -X POST localhost:8780/devices/_/batch \
-H 'content-type: application/json' \
-d '{"steps":[["home"],["sleep",500],["recents"]]}'{"id":1,"cmd":"batch","steps":[["home"],["sleep",500],["recents"]]}크롬
chrome.go
크롬에서 주소 열기
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
url | string | 필수 | 주소. https://가 없으면 붙임 |
new_tab | bool | false | 새 탭에서 열기 |
반환: 다음 필드를 가진 객체: ms
에러: APP_NOT_FOUND
d.chrome.go("droidline.dev")await d.chrome.go("droidline.dev");await d.Chrome.GoAsync("droidline.dev");droidline chrome.go droidline.devcurl -s -X POST localhost:8780/devices/_/chrome.go \
-H 'content-type: application/json' \
-d '{"url":"droidline.dev"}'{"id":1,"cmd":"chrome.go","url":"droidline.dev"}알림
notificationshas_notificationwait_notificationnotification_replynotification_clicknotification_dismissnotify_filteron_notification
notifications
지금 떠 있는 알림 목록
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
package | string | 이 앱만 |
반환: 다음 타입의 값: list<notification>
d.notifications()await d.notifications();await d.NotificationsAsync();droidline notificationscurl -s -X POST localhost:8780/devices/_/notifications \
-H 'content-type: application/json'{"id":1,"cmd":"notifications"}has_notification
지금 떠 있는 알림 중 조건에 맞는 게 있으면 true
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
by | string text | textContains | title | package | 필수 | text, textContains는 제목과 본문 모두에서 찾음 |
value | string | 찾을 값. by가 쿼리 객체이면 생략 |
반환: 다음 타입의 값: bool
d.has_notification("textContains", "배송")await d.hasNotification("textContains", "배송");await d.HasNotificationAsync("textContains", "배송");droidline has_notification textContains "배송"curl -s -X POST localhost:8780/devices/_/has_notification \
-H 'content-type: application/json' \
-d '{"by":"textContains","value":"배송"}'{"id":1,"cmd":"has_notification","by":"textContains","value":"배송"}wait_notification
조건에 맞는 알림이 오면 내용 반환
PC 서버가 처리하므로 폰의 다른 명령을 막지 않습니다. notify_filter로 고른 앱의 알림만 보이며, 기본값은 없음입니다. Android 15 이상은 인증번호를 가려서 넘기므로 알림 도착만 알 수 있습니다
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
by | string text | textContains | title | package | 필수 | text, textContains는 제목과 본문 모두에서 찾음 |
value | string | 찾을 값. by가 쿼리 객체이면 생략 | |
timeout | number | 60 s | 기다리는 초 |
package | string | 이 앱에서 온 것만 |
반환: 다음 타입의 값: notification
에러: TIMEOUT
dl.wait_notification("textContains", "인증번호", 60)await dl.waitNotification("textContains", "인증번호", 60);await client.WaitNotificationAsync("textContains", "인증번호", 60);droidline wait_notification textContains "인증번호" 60curl -s -X POST localhost:8780/server/wait_notification \
-H 'content-type: application/json' \
-d '{"by":"textContains","value":"인증번호","timeout":60}'{"id":1,"cmd":"wait_notification","by":"textContains","value":"인증번호","timeout":60}notification_reply
답장 버튼이 있는 알림에 바로 답장
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
key | string | 필수 | notifications() 또는 알림 이벤트의 key |
text | string | 필수 | 답장 글 |
반환: 없음
n = d.notifications()[0]
d.notification_reply(n["key"], "가는 중이에요")const [n] = await d.notifications();
await d.notificationReply(n.key, "가는 중이에요");var n = (await d.NotificationsAsync())[0];
await d.NotificationReplyAsync((string)n.Key!, "가는 중이에요");KEY=$(droidline --json notifications | jq -r '.value[0].key')
droidline notification_reply "$KEY" "가는 중이에요"curl -s -X POST localhost:8780/devices/_/notification_reply \
-H 'content-type: application/json' \
-d '{"key":"KEY","text":"가는 중이에요"}'{"id":1,"cmd":"notification_reply","key":"KEY","text":"가는 중이에요"}notification_click
알림을 눌러 해당 화면 열기
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
key | string | 필수 | notifications() 또는 알림 이벤트의 key |
반환: 없음
n = d.notifications()[0]
d.notification_click(n["key"])const [n] = await d.notifications();
await d.notificationClick(n.key);var n = (await d.NotificationsAsync())[0];
await d.NotificationClickAsync((string)n.Key!);KEY=$(droidline --json notifications | jq -r '.value[0].key')
droidline notification_click "$KEY"curl -s -X POST localhost:8780/devices/_/notification_click \
-H 'content-type: application/json' \
-d '{"key":"KEY"}'{"id":1,"cmd":"notification_click","key":"KEY"}notification_dismiss
알림 지우기
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
key | string | 필수 | notifications() 또는 알림 이벤트의 key |
반환: 없음
n = d.notifications()[0]
d.notification_dismiss(n["key"])const [n] = await d.notifications();
await d.notificationDismiss(n.key);var n = (await d.NotificationsAsync())[0];
await d.NotificationDismissAsync((string)n.Key!);KEY=$(droidline --json notifications | jq -r '.value[0].key')
droidline notification_dismiss "$KEY"curl -s -X POST localhost:8780/devices/_/notification_dismiss \
-H 'content-type: application/json' \
-d '{"key":"KEY"}'{"id":1,"cmd":"notification_dismiss","key":"KEY"}notify_filter
PC로 보낼 알림 앱 고르기. 기본값은 아무 앱도 보내지 않음
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
packages | list<string> | 허용할 패키지. 생략하면 현재 목록 조회 |
반환: 다음 타입의 값: list<string>
d.notify_filter(["com.android.chrome", "com.google.android.gm"])await d.notifyFilter(["com.android.chrome", "com.google.android.gm"]);await d.NotifyFilterAsync(new[] { "com.android.chrome", "com.google.android.gm" });droidline notify_filter com.android.chrome,com.google.android.gmcurl -s -X POST localhost:8780/devices/_/notify_filter \
-H 'content-type: application/json' \
-d '{"packages":["com.android.chrome","com.google.android.gm"]}'{"id":1,"cmd":"notify_filter","packages":["com.android.chrome","com.google.android.gm"]}on_notification
조건에 맞는 알림마다 함수 호출
SDK 전용, subscribe 위에 구현. CLI는 맞는 알림을 JSON 줄로 출력
SDK 안에서 동작합니다. 서버에는 subscribe 줄이 갑니다.
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
package | string | 이 앱에서 온 것만 | |
textContains | string | 제목이나 본문에 이 글이 있을 때만 |
반환: 없음
stop = d.on_notification(package="com.google.android.gm", callback=print)
# ... later
stop()const stop = await d.onNotification({ package: "com.google.android.gm" }, (n) => console.log(n.title, n.text));
// ... later
stop();var stop = await d.OnNotificationAsync(n => Console.WriteLine($"{n.Title} {n.Text}"), package: "com.google.android.gm");
// ... later
stop.Dispose();droidline on_notification --package com.google.android.gm{"id":1,"cmd":"subscribe","events":["notification"]}문자, 통화, 연락처
sms
폰에 저장된 문자 메시지, 최신순
선택 기능입니다. 먼저 앱의 설정 탭에서 문자를 허용하세요. 허용 전에는 NO_PERMISSION으로 답합니다. SMS와 MMS의 글자를 읽습니다. 채팅(RCS) 메시지는 메시지 앱이 따로 보관하므로 포함되지 않습니다. MCP 서버는 --tools에 이 이름을 넣었을 때만 이 도구를 보여 줍니다
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
box | string inbox | sent | all | "inbox" | 받은 문자, 보낸 문자, 또는 둘 다 |
address | string | 번호나 보낸 사람에 이 글자가 들어간 것만. 공백과 -는 무시 | |
contains | string | 본문에 이 글자가 들어간 것만, 대소문자 무시 | |
within | number | 0 s | 최근 이 초 안의 것만. 0이면 기간 제한 없음 |
max | int | 20 | 돌려줄 최대 개수, 500까지 |
반환: 다음 타입의 값: list<sms>
calls
통화 기록, 최신순
선택 기능입니다. 먼저 앱의 설정 탭에서 통화 기록을 허용하세요. 허용 전에는 NO_PERMISSION으로 답합니다. 전화 앱으로 한 통화만 나오며, 메신저 같은 앱 안의 통화는 보통 나오지 않습니다. MCP 서버는 --tools에 이 이름을 넣었을 때만 이 도구를 보여 줍니다
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
type | string all | incoming | outgoing | missed | rejected | blocked | "all" | 어떤 통화 |
number | string | 번호나 저장된 이름에 이 글자가 들어간 것만. 공백과 -는 무시 | |
within | number | 0 s | 최근 이 초 안의 것만. 0이면 기간 제한 없음 |
max | int | 20 | 돌려줄 최대 개수, 500까지 |
반환: 다음 타입의 값: list<call>
contacts
폰에 저장된 연락처, 이름순
선택 기능입니다. 먼저 앱의 설정 탭에서 연락처를 허용하세요. 허용 전에는 NO_PERMISSION으로 답합니다. MCP 서버는 --tools에 이 이름을 넣었을 때만 이 도구를 보여 줍니다
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
query | string | 이름, 번호, 이메일에 이 글자가 들어간 연락처만, 대소문자 무시. 번호의 공백과 -는 무시 | |
max | int | 50 | 돌려줄 최대 개수, 500까지 |
반환: 다음 타입의 값: list<contact>
서버
devicesleasereleasepairpair_qrrenamerevokesubscribeserver_infoauth
devices
등록된 기기와 온라인 상태, 접속 경로
반환: 다음 타입의 값: list<device>
dl.devices()await dl.devices();await client.DevicesAsync();droidline devicescurl -s localhost:8780/devices{"id":1,"cmd":"devices"}lease
빈 폰 하나를 빌려 다른 스크립트가 못 쓰게 하기
선택 기능입니다. 아무도 빌리지 않은 폰은 평소처럼 동작합니다. 빌린 동안에는 그 lease를 함께 보낸 요청만 통하고, 나머지는 DEVICE_LEASED로 실패합니다. release를 부르거나 ttl초 동안 명령이 없으면 끝납니다
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
device | string | 이 폰, ID나 이름. 생략하면 아무 빈 폰 | |
wait | number | 30 s | 폰이 빌 때까지 기다리는 초 |
ttl | number | 300 s | 명령 없이 이 시간이 지나면 lease가 끝남 |
min_sdk | int | 이 Android API 레벨 이상인 폰만, 예: 33 | |
model | string | 모델명에 이 글자가 들어간 폰만 |
반환: 다음 필드를 가진 객체: lease, device, name, ttl
에러: NO_FREE_DEVICE, DEVICE_NOT_FOUND
dl.lease(wait=60)await dl.lease({ wait: 60 });await client.LeaseAsync(wait: 60);droidline lease --waitcurl -s -X POST localhost:8780/server/lease \
-H 'content-type: application/json'{"id":1,"cmd":"lease"}release
빌린 폰 돌려주기
lease를 넘기거나, 스크립트가 쥔 채로 죽어 버린 폰이면 device를 넘겨 강제로 풉니다
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
lease | string | lease가 돌려준 값 | |
device | string | 어떤 lease가 쥐고 있든 이 폰을 풀어 줌 |
반환: 없음
dl.release("l-3f9a1c0d2e4b")await dl.release("l-3f9a1c0d2e4b");await client.ReleaseAsync("l-3f9a1c0d2e4b");droidline release l-3f9a1c0d2e4bcurl -s -X POST localhost:8780/server/release \
-H 'content-type: application/json' \
-d '{"lease":"l-3f9a1c0d2e4b"}'{"id":1,"cmd":"release","lease":"l-3f9a1c0d2e4b"}pair
이 6자리 코드를 띄운 폰을 등록
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
code | string | 필수 | 폰에 표시된 코드 |
name | string | 기기에 붙일 이름 |
반환: 다음 타입의 값: device
에러: PAIRING_FAILED
dl.pair("482913", name="shelf-01")await dl.pair("482913", { name: "shelf-01" });await client.PairAsync("482913", name: "shelf-01");droidline pair 482913 --name shelf-01curl -s -X POST localhost:8780/server/pair \
-H 'content-type: application/json' \
-d '{"code":"482913","name":"shelf-01"}'{"id":1,"cmd":"pair","code":"482913","name":"shelf-01"}pair_qr
10분 동안 유효한 일회용 페어링 QR 만들기
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
name | string | 기기에 붙일 이름 |
반환: 다음 필드를 가진 객체: uri, expires
dl.pair_qr()await dl.pairQr();await client.PairQrAsync();droidline pair # shows the QR code in the terminalcurl -s -X POST localhost:8780/server/pair_qr \
-H 'content-type: application/json'{"id":1,"cmd":"pair_qr"}rename
기기 이름 바꾸기
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
device | string | 필수 | 기기 ID 또는 이름 |
name | string | 필수 | 새 이름 |
반환: 다음 타입의 값: device
dl.rename("k7d2q9xa", "shelf-01")await dl.rename("k7d2q9xa", "shelf-01");await client.RenameAsync("k7d2q9xa", "shelf-01");droidline rename k7d2q9xa shelf-01curl -s -X POST localhost:8780/server/rename \
-H 'content-type: application/json' \
-d '{"device":"k7d2q9xa","name":"shelf-01"}'{"id":1,"cmd":"rename","device":"k7d2q9xa","name":"shelf-01"}revoke
기기 등록 폐기. 다시 페어링해야 접속 가능
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
device | string | 필수 | 기기 ID 또는 이름 |
반환: 없음
dl.revoke("shelf-01")await dl.revoke("shelf-01");await client.RevokeAsync("shelf-01");droidline revoke shelf-01curl -s -X POST localhost:8780/server/revoke \
-H 'content-type: application/json' \
-d '{"device":"shelf-01"}'{"id":1,"cmd":"revoke","device":"shelf-01"}subscribe
이 연결로 이벤트 받기
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
events | list<string> | 필수 | notification, screen, toast, device, result, action 중에서 |
device | string | 이 기기 것만. 생략하면 전체 |
반환: 없음
dl.subscribe(["notification"])await dl.subscribe(["notification"]);await client.SubscribeAsync(new[] { "notification" });{"id":1,"cmd":"subscribe","events":["notification"]}server_info
서버 버전, 포트, 대기 주소
반환: 다음 필드를 가진 객체: version, server, name, proto, agent_port, client_port
dl.server_info()await dl.serverInfo();await client.ServerInfoAsync();droidline server_infocurl -s -X POST localhost:8780/server/server_info \
-H 'content-type: application/json'{"id":1,"cmd":"server_info"}auth
이 클라이언트 연결을 토큰으로 인증
| 이름 | 타입 | 기본값 | 의미 |
|---|---|---|---|
token | string | 필수 | droidline token으로 만든 클라이언트 토큰 |
반환: 없음
dl.auth("your-client-token")await dl.auth("your-client-token");await client.AuthAsync("your-client-token");{"id":1,"cmd":"auth","token":"your-client-token"}