"Docker combat chapter" python of docker- create appium container and container connection security settings appium

On a good appium have downloaded the image, how to create appium went on to say next and how to create a container vessel simulator how to connect appium. Source: https: //github.com/limingios/dockerpython.git (Source / "docker combat chapter" python of docker- create appium container and container connection settings appium Android emulator (30))

  • Introduction appium of docker mirror
    > official website address: https: //github.com/appium/appium-docker-android

  • Start appium container

docker run --privileged -a -p 4723: 4723 --name appium1 Appiae / appium

Description start successfully

  • After the container is started, start Andrews emulator
    > After starting Andrews simulator input by cmd

adb devices

Change the connection mode, change from usb to tcp-ip way

adb -s 127.0.0.1:62001 tcpip 55555

The use of docker appium connected simulator
1 is provided to bridge

Restart the simulator may not obtain ip, click on the next switch, then automatically get under it.

2. Check the simulator ip address

  1. Virtual Machine docker connection simulator

ping 192.168.1.120
docker exec -it appium1 adb connect 192.168.1.120:55555
docker exec -it appium1 adb devices

4. Test python, running docker appium, run the simulator

start up

docker ps -a
docker logs -f appium1

python代码

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2019/3/12 15:11
# @Author  : Aries
# @Site    : 
# @File    : aaa.py
# @Software: PyCharm

from appium import webdriver

cap = {
        "platformName": "Android",
        "platformVersion": "4.4.2",
        "deviceName": "192.168.1.120:55555",
        "udid":"192.168.1.120:55555",
        # 真机的
        # "platformName": "Android",
        # "platformVersion": "7.1.2",
        # "deviceName": "10d4e4387d74",
        "appPackage": "com.ss.android.ugc.aweme",
        "appActivity": "com.ss.android.ugc.aweme.main.MainActivity",
        "noReset": True,
        "unicodeKeyboard": True,
        "resetkeyboard": True
    }

driver = webdriver.Remote("http://192.168.70.100:4723/wd/hub", cap)

运行通过

PS:通过docker appium的方式运行远程的虚拟机,真机也是一样啊,先通过adb devices,找到后,然后改成tcpip的形式,让docker appium连接 设备,代码设置里面区别,基本就是这样。



Guess you like

Origin blog.51cto.com/12040702/2416935