appium+夜神模拟器操作微信小程序,多个模拟器要结合yaml配置文件来并发控制,一万多行代码[建议收藏]

这篇具有很好参考价值的文章主要介绍了appium+夜神模拟器操作微信小程序,多个模拟器要结合yaml配置文件来并发控制,一万多行代码[建议收藏]。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

技术心得

python+appium+夜神模拟器+结合yaml配置文件实现并发采集任务。

 代码如下

import subprocess
from os import system
from appium import webdriver
import time
import yaml
import os

from selenium.webdriver.support.wait import WebDriverWait

from base.base_root import BaseRoot


class BaseDriver(object):

    def __init__(self, device_info):
        self.device_info = device_info

    def release_port(self,port):
        """释放指定的端口"""
        cmd_find = 'netstat -aon | findstr {}'.format(port)  # 查找对应端口的pid
        # 返回命令执行后的结果
        result = os.popen(cmd_find).read()
        if str(port) and 'LISTENING' in result:
            # 获取端口对应的pid进程
            i = result.index('LISTENING')
            start = i + len('LISTENING') + 7
            end = result.index('\n')
            pid = result[start:end]
            cmd_kill = 'taskkill -f -pid %s' % pid  # 关闭被占用端口的pid
            os.popen(cmd_kill)
            print(f'释放进程端口:{port}')
        else:
            print('port %s is available !' % port)
    def restart_start_appium(self, port=4723, udid=""):
        print('netstat -ano | findstr "%s" ' % port)
        a = os.popen('netstat -ano | findstr "%s" ' % port)
        time.sleep(2)
        t1 = a.read()
        if "LISTENING" in t1:
            self.release_port(port)

        # 启动appium服务
        print("appium -p %s -bp %s -U %s --no-reset --session-override" % (port, port, udid))
        #os.system("appium -p %s -bp %s -U %s --no-reset --session-override" % (port, port, udid))

        bootstrap_port = port
        host = '127.0.0.1'
        # cmd命令
        cmd = 'start /b appium -a ' + host + ' -p ' + str(port) + ' -bp ' + str(bootstrap_port)+' -U '+ str(udid)+' --no-reset --session-override '
        print("%s at %s " % (cmd, time.ctime()))
        # cmd 需要执行的shell命令
        showtime = time.strftime('%Y-%m-%d',time.localtime(time.time()))
        curpath = BaseRoot.root_path
        folder = f"/log/appium_log_{showtime}/"
        if not os.path.exists(curpath + f'/{folder}/'):
            os.makedirs(curpath + f'/{folder}/')
        #showtime = time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))
        showtime = time.strftime('%Y-%m-%d-%H',time.localtime(time.time()))
        subprocess.Popen(cmd, shell=True,stdout=open(curpath + f'/{folder}/' + f'{port}.log', 'w', encoding='utf8'),stderr=subprocess.STDOUT)
        #subprocess.Popen(cmd, shell=True)

        time.sleep(1)
    def start_appium(self, port=4723, udid=""):
        print('netstat -ano | findstr "%s" ' % port)
        a = os.popen('netstat -ano | findstr "%s" ' % port)
        time.sleep(2)
        t1 = a.read()
        if "LISTENING" in t1:
            print("appium服务已经启动:%s" % t1)
        else:
            # 启动appium服务
            print("appium -p %s -bp %s -U %s --no-reset --session-override" % (port, port, udid))
            #os.system("appium -p %s -bp %s -U %s --no-reset --session-override" % (port, port, udid))

            bootstrap_port = port
            host = '127.0.0.1'
            # cmd命令
            cmd = 'start /b appium -a ' + host + ' -p ' + str(port) + ' -bp ' + str(bootstrap_port)+' -U '+ str(udid)+' --no-reset --session-override '
            print("%s at %s " % (cmd, time.ctime()))
            # cmd 需要执行的shell命令
            showtime = time.strftime('%Y-%m-%d',time.localtime(time.time()))
            curpath = os.path.dirname(os.path.realpath(__file__))
            folder = f"{curpath}/appium_log_{showtime}"
            if not os.path.exists(folder):
                os.makedirs(folder)
            #showtime = time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))
            showtime = time.strftime('%Y-%m-%d-%H',time.localtime(time.time()))
            subprocess.Popen(cmd, shell=True,stdout=open(curpath + f'/appium_log/' + f'{port}.log', 'w', encoding='utf8'),stderr=subprocess.STDOUT)
            #subprocess.Popen(cmd, shell=True)

            time.sleep(1)

    def get_desired_caps(self, devicesName='62001'):
        '''
        从yaml读取desired_caps配置信息
        参数name:设备名称,如:夜神/雷电
        :return: desired_caps字典格式
        '''
        curpath = os.path.dirname(os.path.realpath(__file__))
        yamlpath = os.path.join(curpath, "ddmc.yaml")
        print("配置地址:%s" % yamlpath)
        f = open(yamlpath, "r", encoding="utf-8")
        a = f.read()
        f.close()
        # 把yaml文件转字典
        d = yaml.load(a, Loader=yaml.FullLoader)
        for i in d:
            if devicesName in i["desc"]:

                #print(i)
                # 启动服务
                #devicesName = i['desired_caps']['udid']
                connect_devicesName = f"127.0.0.1:{devicesName}"

                if i['desired_caps']['zhenji'] == 1:
                    connect_devicesName = i['desired_caps']['udid']


                print("连接设备:%s" %connect_devicesName)

                if i['desired_caps']['zhenji'] == 0:
                    i['port'] = int(devicesName)-20000
                i['desired_caps']['udid'] =connect_devicesName
                i['desired_caps']['deviceName'] =connect_devicesName
                self.restart_start_appium(port=i['port'], udid=connect_devicesName)
                return (i['desired_caps'], i['port'])

    def get_base_driver(self) -> (webdriver,dict):
        """获取driver"""
        # 配置参数
        print("准备启动连接: "+self.device_info)
        desired_caps = self.get_desired_caps(self.device_info)
        root_path = BaseRoot.root_path
        root_path = root_path.replace('\\','/')


        # 设置谷歌驱动地址
        if desired_caps[0]['zhenji'] == 1:
            chromedriverpath = root_path + 'vendor/'+desired_caps[0]['chromedriverpath']
        else:
            chromedriverpath = root_path + 'vendor/chromedriver_win32_v92.0.4515.43.exe'

        #chromedriverpath = os.getcwd().replace('\\','/')+'/chromedriver_win32_v92.0.4515.43.exe'

        desired_caps[0]['chromedriverExecutable'] = chromedriverpath
        desired_caps[0]['chromeOptions'] = {'androidProcess': 'com.tencent.mm:appbrand0'}
        self.driver = webdriver.Remote('http://127.0.0.1:%s/wd/hub' % desired_caps[1], desired_caps[0])
        print("启动微信应用程序1")

        ''''
        self.driver.press_keycode(3)
        time.sleep(19)
        self.driver = webdriver.Remote('http://127.0.0.1:%s/wd/hub' % desired_caps[1], desired_caps[0])
        print("启动微信应用程序1")
        '''


        system(f"title {self.device_info}")

        time.sleep(3)
        self.wait = WebDriverWait(self.driver, 300)
        return (self.driver,desired_caps[0])


if __name__ == '__main__':
    BaseDriver("夜神62001").get_base_driver()

模拟器的配置文件如下:

- desc: 设备名称_夜神62001,appium启动服务端口号_42009
  port: 42009
  desired_caps:
    platformName: Android
    deviceName: FA79F1A08850
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    udid: FA79F1A08850
    platformVersion: 9.1.2
    chromedriverpath: chromedriver_win32_v107.0.5304.62.exe
    zhenji: 1
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62025,appium启动服务端口号_42025
  port: 42025
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62025
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62025
    platformVersion: 7.1.2
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62026,appium启动服务端口号_42026
  port: 42026
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62026
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62026
    platformVersion: 12.0.0
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62027,appium启动服务端口号_42027
  port: 42027
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62027
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62027
    platformVersion: 7.1.2
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62028,appium启动服务端口号_42028
  port: 42028
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62028
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62028
    platformVersion: 7.1.2
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62029,appium启动服务端口号_42029
  port: 42029
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62029
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62029
    platformVersion: 7.1.2
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62030,appium启动服务端口号_42030
  port: 42030
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62030
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62030
    platformVersion: 7.1.2
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62031,appium启动服务端口号_42031
  port: 42031
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62031
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62031
    platformVersion: 7.1.2
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62032,appium启动服务端口号_42032
  port: 42032
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62032
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62032
    platformVersion: 7.1.2
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62033,appium启动服务端口号_42033
  port: 42033
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62033
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62033
    platformVersion: 7.1.2
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62034,appium启动服务端口号_42034
  port: 42034
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62034
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62034
    platformVersion: 7.1.2
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62035,appium启动服务端口号_42035
  port: 42035
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62035
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62035
    platformVersion: 7.1.2
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62036,appium启动服务端口号_42036
  port: 42036
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62036
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62036
    platformVersion: 7.1.2
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62037,appium启动服务端口号_42037
  port: 42037
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62037
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62037
    platformVersion: 7.1.2
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62038,appium启动服务端口号_42038
  port: 42038
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62038
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62038
    platformVersion: 7.1.2
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62039,appium启动服务端口号_42039
  port: 42039
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62039
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62039
    platformVersion: 7.1.2
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62040,appium启动服务端口号_42040
  port: 42040
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62040
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62040
    platformVersion: 7.1.2
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62041,appium启动服务端口号_42041
  port: 42041
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62041
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62041
    platformVersion: 7.1.2
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62042,appium启动服务端口号_42042
  port: 42042
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62042
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62042
    platformVersion: 7.1.2
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62043,appium启动服务端口号_42043
  port: 42043
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62043
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62043
    platformVersion: 7.1.2
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62044,appium启动服务端口号_42044
  port: 42044
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62044
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62044
    platformVersion: 7.1.2
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62045,appium启动服务端口号_42045
  port: 42045
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62045
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62045
    platformVersion: 7.1.2
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62046,appium启动服务端口号_42046
  port: 42046
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62046
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62046
    platformVersion: 7.1.2
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62047,appium启动服务端口号_42047
  port: 42047
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62047
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62047
    platformVersion: 7.1.2
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62048,appium启动服务端口号_42048
  port: 42048
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62048
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62048
    platformVersion: 7.1.2
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62049,appium启动服务端口号_42049
  port: 42049
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62049
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62049
    platformVersion: 7.1.2
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62050,appium启动服务端口号_42050
  port: 42050
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62050
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62050
    platformVersion: 7.1.2
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62051,appium启动服务端口号_42051
  port: 42051
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62051
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62051
    platformVersion: 7.1.2
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62052,appium启动服务端口号_42052
  port: 42052
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62052
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62052
    platformVersion: 7.1.2
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62053,appium启动服务端口号_42053
  port: 42053
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62053
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62053
    platformVersion: 7.1.2
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62054,appium启动服务端口号_42054
  port: 42054
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62054
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62054
    platformVersion: 7.1.2
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62055,appium启动服务端口号_42055
  port: 42055
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62055
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62055
    platformVersion: 7.1.2
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62056,appium启动服务端口号_42056
  port: 42056
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62056
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62056
    platformVersion: 7.1.2
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62057,appium启动服务端口号_42057
  port: 42057
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62057
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62057
    platformVersion: 7.1.2
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62058,appium启动服务端口号_42058
  port: 42058
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62058
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62058
    platformVersion: 7.1.2
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62059,appium启动服务端口号_42059
  port: 42059
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62059
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62059
    platformVersion: 7.1.2
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI
- desc: 设备名称_夜神62060,appium启动服务端口号_42060
  port: 42060
  desired_caps:
    platformName: Android
    deviceName: 127.0.0.1:62060
    unicodeKeyboard: !!bool True
    resetKeyboard: !!bool True
    noReset: !!bool True
    newCommandTimeout: 6000
    udid: 127.0.0.1:62060
    platformVersion: 7.1.2
    chromedriverpath: chromedriver_win32_v92.0.4515.43.exe
    zhenji: 0
    appPackage: com.tencent.mm
    appActivity: .ui.LauncherUI

欢迎大家一起学习,一起进步,喜欢私聊。文章来源地址https://www.toymoban.com/news/detail-642870.html

到了这里,关于appium+夜神模拟器操作微信小程序,多个模拟器要结合yaml配置文件来并发控制,一万多行代码[建议收藏]的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • python+appium+夜神模拟器搭建app自动化环境

    目录 1.Appium用法 2.准备工具 1、安装JDK并配置JDK的环境变量 2、安装安卓SDK并配置SDK的环境变量。 3、安装夜神模拟器并在模拟器上安装被测app 4、安装并配置python 5、安装Node js 6、安装和配置Appium appium是做app的一个自动化框架,它的主要优势是支持android和ios,另外脚本语言也

    2024年02月07日
    浏览(54)
  • appium下载安装及环境配置及夜神模拟器下载、nodejs安装

    appium所需要的环境有:jdk、android sdk、Nodejs、appium客户端 此次教程只针对于windows jdk、Android sdk已下载安装配置好环境,此次教程不再重复记录 jdk可看这篇博文jdk安装及环境配置 Android sdk 可看这篇 Android SDK下载与安装 1、下载地址:nodejs 根据自己系统下载对应的安装包 2、安

    2024年02月12日
    浏览(55)
  • uniapp项目如何运行在微信小程序模拟器上

    在HbuilderX中的小程序写完后自己一定要保存,否则会出不来效果 那么怎么让uniapp项目运行在微信小程序开发工具中呢 1 在hbuilderx中点击运行到小程序模拟器 2 然后在项目目录中会生成一个文件夹 在微信小程序开发软件中的工具安全设置打开端口 或者在微信小程序中导入项目

    2024年02月13日
    浏览(45)
  • 最新微信小程序反编译方法(亲测有效,无需模拟器)

    此方法是本人多次试错意外发现的方法,以下是本人遇到的问题及解决方法,有其他方法欢迎讨论 1.下载node.js,直接去官网下载,配置教程网上有这里不讲了。 确保安装目录下有npm文件夹,后面会用到。 2.下载破解工具并解压,我解压到桌面https://codeload.github.com/superBiuBiuMan

    2023年04月08日
    浏览(47)
  • 通过Fiddler模拟器抓包微信小程序(适用APP)

    下载模拟器 准备抓包软件(fiddler或者Charles) fiddler设置 (1)打开设置:Tools-Options (2)点击Connections,设置端口和勾选第二个选项 (3)点击HTTPS,勾选前三个选项,下载证书 4、模拟器设置(夜神模拟器) (1)开启root权限 (2) 打开模拟器wlan设置 (长按连接的无线) 5、

    2023年04月18日
    浏览(51)
  • 使用Mac电脑反编译微信小程序 (无需移动端模拟器)

    以往反编译小程序源码都是要从移动端获取,现在pc端(mac和win)都支持了小程序,从pc端获取显然是更方便的,由于本人使用的的macbook,本篇文章将会讨论如何从mac端获取小程序源码。 mac版微信版本: 3.8.0 node: 18.12.0 node版本wxappUnpacker 注:mac版微信版本大于3.8.0的(无需解

    2024年02月03日
    浏览(60)
  • Hbuilder无法正常运行微信小程序模拟器到指定页面为启动页

    来龙去脉 我们在使用hbuilderx软件运行uni-app项目时, pages.json pages 数组的首项为应用启动页,默认情况下,选择运行项目预览,打开的页面路径自然是 pages/index/index 。 但是我这里选择 pages/my/my.vue 文件,然后选择菜单【运行】【运行到小程序模拟器】【微信开发者工具 - 指定

    2024年02月11日
    浏览(69)
  • adb连接夜神模拟器

       回车即可进入cmd命令行  然后输入命令 adb connect 127.0.0.1:62001  5.查看 adb devices 这样就是连接成功了,就可以通过adb命令对夜神的模拟器进行编辑了

    2024年02月13日
    浏览(45)
  • 微信小程序在模拟器可以显示,手机扫编译二维码显示不了 解决办法

    1,本地服务器即是使用localhost,如果希望在手机上可以演示,请把微信开发者工具代码中wx.request请求数据的所有带有localhost的路径全部替换本机的ip地址,如http://localhost:8080/test/hhh, 改成http://172.00.00.000/test/hhh, 这里只是举个例子,查看ip地址方法: 打开cmd,输入ipconfig,红色

    2024年02月12日
    浏览(41)
  • 解决微信开发者工具企业微信小程序模式下模拟器白屏问题

    前一天晚上没有关电脑,第二天发现电脑自己重启了,然后微信开发者工具就出了问题,在企业微信小程序模式下,模拟器出现了白屏,只有上方title可以正常显示。点击模拟器右上角三个点都不出弹出菜单,并且在调试器可正常显示Wxml和接口调用,手机扫描预览生成的二维

    2024年02月09日
    浏览(61)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包