-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathmacaca.js
65 lines (62 loc) · 1.36 KB
/
macaca.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
var path = require('path');
var JWebDriver = require('../');
var driver = new JWebDriver({
port: 3456
});
var appPath = '../test/resource/android.zip';
driver.session({
'platformName': 'android',
'app': path.resolve(appPath)
})
.wait('//*[@resource-id="com.github.android_app_bootstrap:id/mobileNoEditText"]')
.sendElementKeys('中文+Test+12345678')
.wait('//*[@resource-id="com.github.android_app_bootstrap:id/codeEditText"]')
.sendElementKeys('22222\n')
.wait('name', 'Login')
.click()
.wait('name', 'list')
.prop('text')
.then(function(text){
console.log(text)
})
.rect()
.then(function(rect){
console.log(rect)
})
.click()
.sendActions('drag', {
fromX: 200,
fromY: 400,
toX: 200,
toY: 100,
duration: 0.5
})
.sendActions('drag', {
fromX: 100,
fromY: 100,
toX: 100,
toY: 400,
duration: 0.5
})
.wait('name', 'Gesture')
.click()
.back()
.back()
.wait('name', 'Baidu')
.click()
.webview()
.wait('#index-kw')
.sendKeys('mp3')
.wait('#index-bn')
.click()
.url()
.then(function(url){
console.log(url);
})
.title()
.then(function(title){
console.log(title);
})
.native()
.wait('name', 'PERSONAL')
.click();