标签:信息 eve elf 后台 查看 不同的 mat package 创建
import time
import threading
def sing():
for i in range(5):
print("唱歌")
time.sleep(1)
def dance():
for i in range(5):
print("跳舞")
time.sleep(1)
t1 = threading.Thread(target=sing)
t2 = threading.Thread(target=dance)
t1.start()
t2.start()
import time
import threading
def sing():
for i in range(5):
print("唱歌")
time.sleep(1)
def dance():
for i in range(5):
print("跳舞")
time.sleep(1)
sing()
dance()
唱歌
跳舞
跳舞
唱歌
跳舞
唱歌
跳舞
唱歌
跳舞
唱歌
import time
import threading
def sing(nums):
for i in range(nums):
print("唱歌")
time.sleep(1)
def dance():
for i in range(5):
print("跳舞")
time.sleep(1)
t1 = threading.Thread(target=sing, args=(3,))
t2 = threading.Thread(target=dance)
t1.start()
t2.start()
import threading
class Work1(threading.Thread):
def __init__(self, nums):
super().__init__()
self.nums = nums
def run(self):
for i in range(self.nums):
print("haha")
def main():
w = Work1(2)
w.start()
if __name__ == "__main__":
main()
appium -p 4723 -bp 4724 -U 192.168.57.101:5555
ports = ["4723", "4725"]
for i in ports:
threading.Thread(target=do, args=(i,)).start()
appium -p 4723 -bp 4724 -U 192.168.57.101:5555
appium -p 4725 -bp 4726 -U 192.168.57.102:5555
appium -p 4723 -bp 4724 -U 192.168.57.101:5555
appium -p 4725 -bp 4726 -U 192.168.57.102:5555
from appium import webdriver
def init_driver(port="4723"):
# server 启动参数
desired_caps = dict()
# 设备信息
desired_caps[‘platformName‘] = ‘Android‘
desired_caps[‘platformVersion‘] = ‘5.1‘
desired_caps[‘deviceName‘] = ‘192.168.164.101:5555‘
# app信息
desired_caps[‘appPackage‘] = ‘com.android.settings‘
desired_caps[‘appActivity‘] = ‘.Settings‘
# 中文
desired_caps[‘unicodeKeyboard‘] = True
desired_caps[‘resetKeyboard‘] = True
# 不重置应用
desired_caps[‘noReset‘] = True
# toast
# desired_caps[‘automationName‘] = ‘Uiautomator2‘
# 声明对象
driver = webdriver.Remote(‘http://localhost:‘ + port + ‘/wd/hub‘, desired_caps)
return driver
from base_action import BaseAction
class LoginPage(BaseAction):
pass
import threading
from selenium.webdriver.common.by import By
from base_driver import init_driver
from base_action import BaseAction
from login_page import LoginPage
def do(port):
driver = init_driver(port)
login_page = LoginPage(driver)
if "4723" == port:
login_page.click((By.XPATH, "text,更多"))
else:
login_page.click((By.XPATH, "text,WLA"))
def main():
//根据ports不同,driver可以连接不同的手机
ports = ["4723", "4725"]
for i in ports:
threading.Thread(target=do, args=(i,)).start()
if __name__ == ‘__main__‘:
main()
标签:信息 eve elf 后台 查看 不同的 mat package 创建
原文地址:https://www.cnblogs.com/st998/p/13808117.html