用命令启动appium,报错,是nodejs版本问题么?都是报的adb.js的问题

来源:1-12 id定位进行登录操作

慕无忌3415328

2020-04-27

报错日志:
info: Welcome to Appium v1.4.16 (REV ae6877eff263066b26328d457bd285c0cc62430d) info: Appium REST http interface listener started on 0.0.0.0:4723 info: [debug] Non-default server args: {“udid”:“0123456789ABCDEF”,“bootstrapPort”:4721,“sessionOverride”:true,“noReset”:true,“log”:“D:/SmartBearKit_2020_03_17/smartbearkit/smartbear/log/test001.log”} info: Console LogLevel: debug info: File LogLevel: debug info: --> POST /wd/hub/session {“capabilities”:{“firstMatch”:[{“platformName”:“Android”,“appium:platformVersion”:“9.0.0”,“appium:deviceName”:“0123456789ABCDEF”,“appium:appPackage”:“com.lvshou.smartbearkit”,“appium:appActivity”:“com.lvshou.module.main.MainActivity”}]},“desiredCapabilities”:{“platformName”:“Android”,“platformVersion”:“9.0.0”,“deviceName”:“0123456789ABCDEF”,“appPackage”:“com.lvshou.smartbearkit”,“appActivity”:“com.lvshou.module.main.MainActivity”}} info: Client User-Agent string: appium/python 0.50 (selenium/3.141.0 (python windows)) info: [debug] Didn’t get app but did get Android package, will attempt to launch it on the device info: [debug] Creating new appium session 77c4aaf0-191d-4d96-8a12-70e9127ec80d info: Starting android appium info: [debug] Getting Java version info: Java version is: 1.8.0_221 info: [debug] Checking whether adb is present info: [debug] Using adb from E:\sdk_pad\platform-tools\adb.exe warn: No app capability, can’t parse package/activity info: [debug] Using fast reset? false info: [debug] Preparing device for session info: [debug] Not checking whether app is present since we are assuming it’s already on the device info: Retrieving device info: [debug] Trying to find a connected android device info: [debug] Getting connected devices… info: [debug] executing cmd: E:\sdk_pad\platform-tools\adb.exe devices info: [debug] 1 device(s) connected info: Found device 0123456789ABCDEF info: [debug] Setting device id to 0123456789ABCDEF 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: this.shell 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:204:7) at emitTwo (events.js?13) at ChildProcess.emit (events.js:185:7) at maybeClose (internal/child_process.js:827:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5) context: [POST /wd/hub/session {“capabilities”:{“firstMatch”:[{“platformName”:“Android”,“appium:platformVersion”:“9.0.0”,“appium:deviceName”:“0123456789ABCDEF”,“appium:appPackage”:“com.lvshou.smartbearkit”,“appium:appActivity”:"com]

server的代码:
class Server:
def init(self):
self.dos = DosCmd()
def start_server(self):
command = "appium -p 4723 -bp 4721 -U 0123456789ABCDEF --no-reset --session-override --log D:/SmartBearKit_2020_03_17/smartbearkit/smartbear/log/test001.log"
self.dos.excute_cmd(command)

def main(self):
    appium_start = threading.Thread(target=self.start_server)
    appium_start.start()
    time.sleep(30)

if name == ‘main’:
server = Server()

写回答

6回答

慕无忌3415328

提问者

2020-05-01

//img.mukewang.com/szimg/5eaba166091e3d5d03000081.jpg。。。

0
0

慕无忌3415328

提问者

2020-04-29

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

补日志截图

0
0

慕无忌3415328

提问者

2020-04-29

server.py的代码:
import time
class Server:
    def __init__(self):
        self.dos = DosCmd()
    def start_server(self):
        command = "appium -p 4723 -bp 4721 -U 0123456789ABCDEF --no-reset --session-override --log D:/SmartBearKit_2020_03_17/smartbearkit/smartbear/log/test001.log"
        self.dos.excute_cmd(command)

    def main(self):
        appium_start = threading.Thread(target=self.start_server)
        appium_start.start()
        time.sleep(30)

if __name__ == '__main__':
    server = Server()
from server import Server
from get_data import GetData
from action_method import ActionMethod
from dos_cmd import DosCmd
class RunMain:
   def run_method(self):
      #dos = DosCmd()
      #command = "appium -p 4723 -bp 4721 -U 127.0.0.1:4723 --no-reset --session-override --log D:/SmartBearKit_2020_03_17/smartbearkit/smartbear/log/test001.log"
      #dos.excute_cmd(command)
      server = Server()
      server.main()
      data = GetData()
      action_method = ActionMethod()
      lines = data.get_case_lines()
      for i in range(1,lines):
         handle_step = data.get_handle_step(i) #操作步骤
         element_key = data.get_element_key(i) #元素
         handle_value = data.get_handle_value(i)#操作值
         expect_key = data.get_expect_element(i)#预期元素
         expect_step = data.get_expect_handle(i)#预期步骤
         is_run = data.get_is_run(i) #是否执行
         #input()  login_button
         #input  str
         #None
         excute_method = getattr(action_method,handle_step)  #
         if element_key != None:
            excute_method(element_key,handle_value) #操作步骤作为对象引用
         else:
            excute_method(handle_value)
         if expect_step != None:
            expect_result = getattr(action_method,expect_step)
            result = expect_result(expect_key)
            if result:
               data.write_value(i,"pass")
            else:
               data.write_value(i,"fail")
         if is_run != None:
            if is_run == 'yes':
               return True
            else:
               return False

if __name__ == '__main__':
   run = RunMain()
   run.run_method()

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

0
16
Mushishi
回复
慕无忌3415328
不错不错 你这个真的是艰难险阻
2020-05-06
共16条回复

慕无忌3415328

提问者

2020-04-29

cmd启动appium://img.mukewang.com/szimg/5ea91f7309f6ab8e06630076.jpg

0
0

慕无忌3415328

提问者

2020-04-28

嗯,是的,cmd命令启动,报错

0
0

Mushishi

2020-04-27

你appium cmd正常启动有问题吗?

0
3
慕无忌3415328
回复
Mushishi
cmd命令窗口启动:这里不能截图,补截图如上
2020-04-29
共3条回复

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

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

1508 学习 · 1333 问题

查看课程