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

来源:9-4 【补充】Appium_ios_元素定位

慕无忌3415328

2020-01-14

报错详情信息:

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()

写回答

5回答

慕无忌3415328

提问者

2020-01-15

//img.mukewang.com/szimg/5e1e830a0903098508390891.jpg

//img.mukewang.com/szimg/5e1e839a09b9e6f705750241.jpg

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

0
0

慕无忌3415328

提问者

2020-01-15

//img.mukewang.com/szimg/5e1e8073096f3f2b17690817.jpg

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

0
0

慕无忌3415328

提问者

2020-01-15

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

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

0
0

Mushishi

2020-01-14

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

0
2
Mushishi
回复
慕无忌3415328
1、appium版本太老了,记得永appium desk那个版本,也教了你们下载最新的。 2、adb调 这个你看一下你是不是模拟器和你sdk的adb版本不一样。
2020-02-14
共2条回复

慕无忌3415328

提问者

2020-01-14

appiumforwindows装的是1.4.16,node.js 是5.6.0

0
0

Python主讲移动端自动化测试框架Appium

APP自动化基础知识、po模型、关键字模型、服务自动化、持续集成

1508 学习 · 1333 问题

查看课程