好嘞,上菜!
1.keyevent(self, keycode, metastate=none)
sends a keycode to the device. android only. possible keycodes can be
found in
:args:
- keycode - the keycode to be sent to the device
- metastate - meta information about the keycode being sent
這個api的大概意思是:傳送乙個鍵碼到裝置上
鍵碼表後面粘,現在我先試試 "keycode_menu":
"菜單鍵":82
執行**:
driver.keyevent(82)
driver.keyevent('82')
效果是一樣的
結果:
沒毛病~"菜單鍵",點選完,是這個效果.
再試試另外一種寫法:
driver.keyevent(keycode_menu)
結果:nameerror: name 'keycode_menu' is not defined,報錯了,說沒有定義
2.press_keycode(self, keycode, metastate=none)
sends a keycode to the device. android only. possible keycodes can be
found in
:args:
- keycode - the keycode to be sent to the device
- metastate - meta information about the keycode being
sent
這個api的大概意思是:傳送乙個鍵碼到裝置上
悲催的發現press_keycode和keyevent用法是一樣的,不重複寫了`````也沒找到,他兩啥區別
3.long_press_keycode(self, keycode, metastate=none)
sends a long press of keycode to the device. android only. possible keycodes can be
found in
:args:
- keycode - the keycode to be sent to the device
- metastate - meta information about the keycode being sent
這個api的大概意思是:傳送乙個鍵碼到裝置上,長按
appium 常用鍵盤操作
例如 driver.keyevent 4 模擬按下手機鍵盤的返回driver.keyevent 66 模擬鍵盤回車附上手機鍵盤各按鍵的數字代號 鍵keycode call 撥號鍵 5 keycode endcall 掛機鍵 6 keycode home 按鍵home 3 keycode menu 菜...
模擬鍵盤按鍵
模擬全域性按鍵可以用keybd event,sendinput來完成,下面是模擬一次caps lock 按鍵時兩個api函式的實現方法 keybd event keybd event vk capital,0,keyeventf extendedkey 0,0 key down keybd even...
模擬鍵盤按鍵
textbox1.focus sendkeys.send v 模擬鍵盤按鍵ctrl v 貼上 鍵 backspace 或或break caps lock del或delete 或向下鍵 endenter 或 esc help home ins或insert 或向左鍵 num lock page do...