请稍等 ...
×

采纳答案成功!

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

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

报错日志:
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()

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

6回答

提问者 慕无忌3415328 2020-05-01 12:11:37

https://img1.sycdn.imooc.com//szimg/5eaba166091e3d5d03000081.jpg。。。

0 回复 有任何疑惑可以回复我~
提问者 慕无忌3415328 2020-04-29 14:46:36

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

补日志截图

0 回复 有任何疑惑可以回复我~
提问者 慕无忌3415328 2020-04-29 14:42:45
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()

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

0 回复 有任何疑惑可以回复我~
  • command = "appium -p 4723 -bp 4721 -U 0123456789ABCDEF --no-reset --session-override --log D:/SmartBearKit_2020_03_17/smartbearkit/smartbear/log/test001.log"
    你这个命令里面别用其他,把uid干掉。
    还有你capabilities里面的uid也干掉。把你capabilities的 代码也发一下。你的uid怎么可能是0123456789这样的呢
    回复 有任何疑惑可以回复我~ 2020-04-29 21:34:09
  • 提问者 慕无忌3415328 回复 Mushishi #2
    这个设备号就是这样的,
    回复 有任何疑惑可以回复我~ 2020-04-30 14:26:52
  • 提问者 慕无忌3415328 回复 Mushishi #3
    desired_caps = {'platformName': 'Android',
    		                'platformVersion': '9.0.0',
    		                #"automationName":"UiAutomator2",
    		                #"noReset":"true",
    		                'deviceName': '0123456789ABCDEF', #0123456789ABCDEF
    		                #'app':'C:\\Users\\admin\\Desktop\\abc.apk',
    		                #'automationName': 'Appium',
    		                'appPackage': 'com.lvshou.smartbearkit', #com.lvshou.smartbearkit.debug
    		                'appActivity': 'com.lvshou.module.main.MainActivity'}
    		driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
    回复 有任何疑惑可以回复我~ 2020-04-30 14:27:06
提问者 慕无忌3415328 2020-04-29 14:32:22

cmd启动appium:https://img1.sycdn.imooc.com//szimg/5ea91f7309f6ab8e06630076.jpg

0 回复 有任何疑惑可以回复我~
提问者 慕无忌3415328 2020-04-28 09:18:45

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

0 回复 有任何疑惑可以回复我~
Mushishi 2020-04-27 22:39:56

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

0 回复 有任何疑惑可以回复我~
  • 提问者 慕无忌3415328 #1
    嗯,是的,cmd命令启动,报错
    回复 有任何疑惑可以回复我~ 2020-04-28 09:18:56
  • Mushishi 回复 提问者 慕无忌3415328 #2
    如果:
    1、你先通过cmd命令窗口去简单执行appium 看是否启动起来,如果启动不起来,说明你环境有问题。此时建议你把node卸载了重新安装一个新版本的稳定版本,然后去cnpm那样安装最新的appium版本。
    2、如果cmd命令窗口简单执行appium版本没问题,然后只是执行脚本报错,你把你代码发一下。以及错误窗口截图。下次日志按照正常日志文件发,这样我看日志看的不是很全。
    回复 有任何疑惑可以回复我~ 2020-04-28 18:13:29
  • 提问者 慕无忌3415328 回复 Mushishi #3
    cmd命令窗口启动:这里不能截图,补截图如上
    回复 有任何疑惑可以回复我~ 2020-04-29 14:31:52
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信