请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

启动appium跑脚本报:error: Unhandled error: TypeError: undefined is not a function

报错详情信息:

info: [debug] Retrying restartAdb
info: [debug] executing cmd: E:\sdk_pad\platform-tools\adb.exe -s 0123456789ABCDEF kill-server
info: [debug] Getting connected devices…
info: [debug] executing cmd: E:\sdk_pad\platform-tools\adb.exe -s 0123456789ABCDEF devices
info: [debug] 1 device(s) connected
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: E:\sdk_pad\platform-tools\adb.exe -s 0123456789ABCDEF wait-for-device
error: Unhandled error: TypeError: undefined is not a function
at [object Object]. (E:\APPIUM\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:942:16)
at [object Object]. (E:\APPIUM\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:180:9)
at ChildProcess.exithandler (child_process.js:742:7)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1016:16)
at Process.ChildProcess._handle.onexit (child_process.js:1088:5) context: [POST /wd/hub/session {“capabilities”:{“firstMatch”:[{“platformName”:“Android”,“appium:platformVersion”:“23”,“appium:noReset”:“true”,“appium:deviceName”:“0123456789ABCDEF”,“appium:automationName”:“Appium”,"appium:appPackag]
代码:
#coding=utf-8
from appium import webdriver
class AppiumTest:
def init(self):
desired_caps = {‘platformName’: ‘Android’,
‘platformVersion’: ‘23’,
#“automationName”:“UiAutomator2”,
“noReset”:“true”,
‘deviceName’: ‘0123456789ABCDEF’, #0123456789ABCDEF
#‘app’:‘C:\Users\admin\Desktop\abc.apk’,
‘automationName’: ‘Appium’,
‘appPackage’: ‘com.lvshou.smartbearkit.debug’,
‘appActivity’: ‘com.lvshou.module.main.MainActivity’}
self.driver = webdriver.Remote(‘http://127.0.0.1:4723/wd/hub’, desired_caps)
self.driver.implicitly_wait(10)
return driver
def test_drug_reminder(self):
self.driver.find_element_by_id(‘com.lvshou.smartbearkit.debug:id/btn_medicine_reminder’)

if name == ‘main’:
runapp = AppiumTest()

正在回答 回答被采纳积分+3

5回答

提问者 慕无忌3415328 2020-01-15 11:14:37

https://img1.sycdn.imooc.com//szimg/5e1e830a0903098508390891.jpg

https://img1.sycdn.imooc.com//szimg/5e1e839a09b9e6f705750241.jpg

这个appium配置这里的platformversion显示不全是为什么,

0 回复 有任何疑惑可以回复我~
提问者 慕无忌3415328 2020-01-15 11:01:32

https://img1.sycdn.imooc.com//szimg/5e1e8073096f3f2b17690817.jpg

重开模拟器之后,还是无法创建这是什么问题呢

0 回复 有任何疑惑可以回复我~
提问者 慕无忌3415328 2020-01-15 09:58:35

https://img1.sycdn.imooc.com/szimg/5e1e718d090ff86617860683.jpg

这个代码最简单 了吧,只是后面说连不上设备而已,证明是可以创建的吧,但是adb突然又连不上设备了,这是什么原因呢?

0 回复 有任何疑惑可以回复我~
Mushishi 2020-01-14 14:51:46

你使用模拟器试一试,看是否有问题。使用最简单的代码看driver是否能够创建。

0 回复 有任何疑惑可以回复我~
  • 提问者 慕无忌3415328 #1
    不能创建,说明?
    回复 有任何疑惑可以回复我~ 2020-02-12 10:55:53
  • Mushishi 回复 提问者 慕无忌3415328 #2
    1、appium版本太老了,记得永appium desk那个版本,也教了你们下载最新的。
    2、adb调 这个你看一下你是不是模拟器和你sdk的adb版本不一样。
    回复 有任何疑惑可以回复我~ 2020-02-14 23:21:35
提问者 慕无忌3415328 2020-01-14 14:37:23

appiumforwindows装的是1.4.16,node.js 是5.6.0

0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号