Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

"docker practice" python docker- to create appium containers and set up appium container connection security

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Now that you have downloaded the image of appium in the previous section, let's talk about how to create an appium, how to create a container and how to connect to an appium container. Source code: https://github.com/limingios/dockerpython.git (source code / "docker practice" python docker- to create appium container and set appium container to connect to Android simulator (30))

Introduction to docker Image of appium

> official website address: https://github.com/appium/appium-docker-android

Start the appium container

Docker run-- privileged-d-p 4723-- name appium1 appium/appium

It indicates that the startup was successful.

After the container starts, start the Android simulator

After starting the Android simulator, enter via cmd

Adb devices

Change the connection mode from usb to tcp-ip

Adb-s 127.0.0.1 62001 tcpip 55555

Appium connection simulator using docker

1. Set as bridging

Restart the simulator, you may not be able to get the ip, click the switch, and then get it automatically.

two。 View the ip address of the simulator

Virtual machine docker connection simulator

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

4. Test python, run docker appium, run simulator

Start

Docker ps-adocker logs-f appium1

Python code

#! / usr/bin/env python#-*-coding: utf-8-*-# @ Time: 2019-3-12 15 Author @ Author: Aries# @ Site: # @ File: aaa.py# @ Software: PyCharmfrom appium import webdrivercap = {"platformName": "Android", "platformVersion": "4.4.2", "deviceName": "192.168.1.120 Vane 55555" "udid": "192.168.1.120 platformVersion 5555", # "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)

Run through

PS: run a remote virtual machine through docker appium, and the real machine is the same. First go through adb devices, find it, and then change it to tcpip to connect the docker appium to the device. The difference in the code settings is basically like this.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report