電話鍵html
KEYCODE_CALL 撥號鍵 5
KEYCODE_ENDCALL 掛機鍵 6
KEYCODE_HOME 按鍵Home 3
KEYCODE_MENU 菜單鍵 82
KEYCODE_BACK 返回鍵 4
KEYCODE_SEARCH 搜索鍵 84
KEYCODE_CAMERA 拍照鍵 27
KEYCODE_FOCUS 拍照對焦鍵 80
KEYCODE_POWER 電源鍵 26
KEYCODE_NOTIFICATION 通知鍵 83
KEYCODE_MUTE 話筒靜音鍵 91
KEYCODE_VOLUME_MUTE 揚聲器靜音鍵 164
KEYCODE_VOLUME_UP 音量增長鍵 24
KEYCODE_VOLUME_DOWN 音量減少鍵 25android
控制鍵web
KEYCODE_ENTER 回車鍵 66
KEYCODE_ESCAPE ESC鍵 111
KEYCODE_DPAD_CENTER 導航鍵 肯定鍵 23
KEYCODE_DPAD_UP 導航鍵 向上 19
KEYCODE_DPAD_DOWN 導航鍵 向下 20
KEYCODE_DPAD_LEFT 導航鍵 向左 21
KEYCODE_DPAD_RIGHT 導航鍵 向右 22
KEYCODE_MOVE_HOME 光標移動到開始鍵 122
KEYCODE_MOVE_END 光標移動到末尾鍵 123
KEYCODE_PAGE_UP 向上翻頁鍵 92
KEYCODE_PAGE_DOWN 向下翻頁鍵 93
KEYCODE_DEL 退格鍵 67
KEYCODE_FORWARD_DEL 刪除鍵 112
KEYCODE_INSERT 插入鍵 124
KEYCODE_TAB Tab鍵 61
KEYCODE_NUM_LOCK 小鍵盤鎖 143
KEYCODE_CAPS_LOCK 大寫鎖定鍵 115
KEYCODE_BREAK Break/Pause鍵 121
KEYCODE_SCROLL_LOCK 滾動鎖定鍵 116
KEYCODE_ZOOM_IN 放大鍵 168
KEYCODE_ZOOM_OUT 縮小鍵 169app
組合鍵ide
KEYCODE_ALT_LEFT Alt+Left
KEYCODE_ALT_RIGHT Alt+Right
KEYCODE_CTRL_LEFT Control+Left
KEYCODE_CTRL_RIGHT Control+Right
KEYCODE_SHIFT_LEFT Shift+Left
KEYCODE_SHIFT_RIGHT Shift+Right測試
基本ui
KEYCODE_0 按鍵'0' 7
KEYCODE_1 按鍵'1' 8
KEYCODE_2 按鍵'2' 9
KEYCODE_3 按鍵'3' 10
KEYCODE_4 按鍵'4' 11
KEYCODE_5 按鍵'5' 12
KEYCODE_6 按鍵'6' 13
KEYCODE_7 按鍵'7' 14
KEYCODE_8 按鍵'8' 15
KEYCODE_9 按鍵'9' 16
KEYCODE_A 按鍵'A' 29
KEYCODE_B 按鍵'B' 30
KEYCODE_C 按鍵'C' 31
KEYCODE_D 按鍵'D' 32
KEYCODE_E 按鍵'E' 33
KEYCODE_F 按鍵'F' 34
KEYCODE_G 按鍵'G' 35
KEYCODE_H 按鍵'H' 36
KEYCODE_I 按鍵'I' 37
KEYCODE_J 按鍵'J' 38
KEYCODE_K 按鍵'K' 39
KEYCODE_L 按鍵'L' 40
KEYCODE_M 按鍵'M' 41
KEYCODE_N 按鍵'N' 42
KEYCODE_O 按鍵'O' 43
KEYCODE_P 按鍵'P' 44
KEYCODE_Q 按鍵'Q' 45
KEYCODE_R 按鍵'R' 46
KEYCODE_S 按鍵'S' 47
KEYCODE_T 按鍵'T' 48
KEYCODE_U 按鍵'U' 49
KEYCODE_V 按鍵'V' 50
KEYCODE_W 按鍵'W' 51
KEYCODE_X 按鍵'X' 52
KEYCODE_Y 按鍵'Y' 53
KEYCODE_Z 按鍵'Z' 54url
*** Settings ***
Library AppiumLibrary
Library Collections
Library String
Library Dialogs
*** Test Cases ***
打開app
Comment Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator'
... app=${CURDIR}/Tudou_Phone_tudouweb.apk
Comment Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator'
... appActivity=com.tudou.ui.activity.WelcomeActivity appPackage=com.tudou.android
Comment Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator'
... browserName=Chrome
Comment Go To Url http://www.baidu.com
後臺app
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android
sleep 10s
Background App 5
關閉app
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android
sleep 10s
Close All Applications
刪除app
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android
Remove Application com.tudou.android
重置app
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android
Pause Execution
Reset Application
定位
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android
Pause Execution
Comment Click Element id=com.tudou.android:id/mytudouText
Comment Click Element name=個人
Comment Click Element xpath=//android.widget.TextView[contains(@text,'個人')]
Comment Click Element class="android".widget.TextView
Click Element android=new UiSelector().text("個人")
Pause Execution
Close All Applications
輸入
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android unicodeKeyboard=${True} resetKeyboard=${True}
Pause Execution
Comment Input Text id=com.tudou.android:id/login_name asdasd
Comment Input Text id=com.tudou.android:id/login_pwd 2312121
Comment Input Value id=com.tudou.android:id/login_name 34534534sdf
按鍵
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android unicodeKeyboard=${True} resetKeyboard=${True}
Pause Execution
Comment Press Keycode 3
Comment Press Keycode 24
清空內容
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android unicodeKeyboard=${True} resetKeyboard=${True}
Pause Execution
Clear Text id=com.tudou.android:id/login_name
點擊按鈕
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android unicodeKeyboard=${True} resetKeyboard=${True}
Pause Execution
Click Button 個人
Comment Click Button 肯定
點擊元素
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android unicodeKeyboard=${True} resetKeyboard=${True}
Pause Execution
Click Element name=個人
Click Element name=立刻登陸
Click Element id=com.tudou.android:id/title_right_text
點擊座標
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android unicodeKeyboard=${True} resetKeyboard=${True}
Pause Execution
Click A Point 300 200
tap
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android unicodeKeyboard=${True} resetKeyboard=${True}
Pause Execution
Tap name=個人
Tap name=立刻登陸
Tap id=com.tudou.android:id/title_right_text
Landscape
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' browserName=Chrome
... unicodeKeyboard=${True} resetKeyboard=${True}
Pause Execution
Landscape
隱藏鍵盤
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android unicodeKeyboard=${True} resetKeyboard=${True}
Pause Execution
Hide Keyboard
搖一搖
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android unicodeKeyboard=${True} resetKeyboard=${True}
Pause Execution
Shake
network
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android unicodeKeyboard=${True} resetKeyboard=${True}
Pause Execution
${a} Get Network Connection Status
Set Network Connection Status 1
滑動
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android unicodeKeyboard=${True} resetKeyboard=${True}
Pause Execution
Swipe 500 500 100 500 500
sleep 2s
Swipe 500 500 100 500 500
scroll
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android unicodeKeyboard=${True} resetKeyboard=${True}
Pause Execution
Comment Scroll name=牛男網 name=暢所欲言秀
Scroll To id=com.tudou.android:id/channel_subclass
zoom
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.baidu.baidumaps.WelcomeScreen
... appPackage=com.baidu.BaiduMap unicodeKeyboard=${True} resetKeyboard=${True}
Pause Execution
Pinch id=com.tudou.android:id/channel_subclass 200% 50
get
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android unicodeKeyboard=${True} resetKeyboard=${True}
Pause Execution
Comment Get Element Attribute
Comment Get Element Location
Comment Get Element Size
Comment Get Elements
Comment Get Source
Comment Log Source
shoudl
Element Attribute Should Match
Element Name Should Be
Element Should Be Disabled
Element Should Be Enabled
Element Value Should Be
Page Should Contain Element
Page Should Contain Text
Page Should Not Contain Element
Page Should Not Contain Text
webview
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android unicodeKeyboard=${True} resetKeyboard=${True}
Pause Execution
${a} Get Contexts
${b} Get Current Context
Switch To Context ${a[1]}
Log Source
Comment Click Element xpath=//a[text()='開掛!那些牛逼閃閃的牛人們']
Go To Url http://www.w3school.com.cn/tiy/t.asp?f=jsref_dialog_create
Pause Execution
Sleep 2s
Select Frame name=i
Click Element //button[text()='試一下']
Sleep 2s
Unselect Frame
Click Element //input[@value='提交代碼']
${url} Get Element Attribute xpath=//*[@id="footer"]/p/a href
webview2
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android
Pause Execution
${a} Get Contexts
${b} Get Current Context
Switch To Context ${a[1]}
Go To Url http://www.w3school.com.cn/tiy/loadtext.asp?f=html_dropdownbox
Pause Execution
Wait Until Page Contains Element name=cars
Select From List name=cars Fiat
Comment Click Element name=cars
Comment Switch To Context ${a[0]}
Comment Click Element name=Audi
Comment Switch To Context ${a[1]}
Get Element Attribute 圖片位置 src
webview3
Open Application http://localhost:4723/wd/hub alias=tudouapp platformName=Android platformVersion=4.4 deviceName='Android Simulator' appActivity=com.tudou.ui.activity.WelcomeActivity
... appPackage=com.tudou.android
Pause Execution
${contexts} Get Contexts
Switch To Context ${contexts[1]}
Click Element //a[text()='測試'] spa