Appium+Python3+iOS真机环境搭建

简介: 前言:Appium 是一个自动化测试开源工具,支持 iOS 平台和 Android 平台上的原生应用,web 应用和混合应用。本次环境配置相关:macOS:10.

前言:

Appium 是一个自动化测试开源工具,支持 iOS 平台和 Android 平台上的原生应用,web 应用和混合应用。

本次环境配置相关:
macOS:10.13.4
Appium-desktop:1.6.1
Xcode:9.3.1


一、环境配置

1、 安装homebrew:

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

2、 安装libimobiledevice

$ brew install libimobiledevice --HEAD

3、 安装carthage:

$ brew install carthage

4、安装node:

$ brew install node

5、安装npm:

$ brew install npm

6、安装ios-deploy:

$ npm install -g ios-deploy

8、安装xcpretty:

$ gem install xcpretty

9、安装appium,appium-doctor

进入官网,下载Appium-1.6.1.dmg,安装即可。

当然你可以使用命令:npm install -g appium来安装appium,但是后面就会各种报错!!(别问我是怎么知道的,我搞了2天。)

$ npm install -g appium-doctor

10、使用appium-doctor 检查Appium iOS环境环境

appium-doctor --ios

info AppiumDoctor Appium Doctor v.1.4.3
info AppiumDoctor ### Diagnostic starting ###
info AppiumDoctor   The Node.js binary was found at: /usr/local/bin/node
info AppiumDoctor   Node version is 10.1.0
info AppiumDoctor   Xcode is installed at: /Applications/Xcode.app/Contents/Developer
info AppiumDoctor   Xcode Command Line Tools are installed.
info AppiumDoctor   DevToolsSecurity is enabled.
info AppiumDoctor   The Authorization DB is set up properly.
info AppiumDoctor   Carthage was found at: /usr/local/bin/carthage
info AppiumDoctor   HOME is set to: /Users/wangjuan
info AppiumDoctor ### Diagnostic completed, no fix needed. ###
info AppiumDoctor
info AppiumDoctor Everything looks good, bye!
info AppiumDoctor

二、安装WebDriverAgent

1、进入appium安装目录下WebDriverAgent文件夹,具体路径参照自己的路径,可以通过find命令查找

cd /Applications/Appium.app/Contents/Resources/app
/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent

2、在WebDriverAgent目录下执行以下命令

mkdir -p Resources/WebDriverAgent.bundle

sh ./Scripts/bootstrap.sh

3、编译WebDriverAgent.xcodeproj

Xcode打开当前目录下的WebDriverAgent.xcodeproj文件
WebDriverAgent.xcodeproj.png

注意️:进入项目后要编辑一些内容,请无比按照步骤全部修改。步骤见下图!!

1、TARGETS->WebDriverAgentLib的Bundle Identifier更改为自己命名的Identifier。(所有Identifier注意保持一致!!)

2、TARGETS->WebDriverAgentLib的Signing选择使用个人的证书。

image.png

3、TARGETS->WebDriverAgentRunner的Signing选择使用个人的证书。

image.png

4、PROJECT->WebDriverAgent的Product Bundle Identifier更改为自己命名的Identifier。(所有Identifier注意保持一致!!)

image.png

5、TARGETS->WebDriverAgentLib的Product Bundle Identifier更改为自己命名的Identifier。(所有Identifier注意保持一致!!)

image.png

6、TARGETS->WebDriverAgentRunner的Product Bundle Identifier更改为自己命名的Identifier。(所有Identifier注意保持一致!!)

image.png

7、Device选择已连接的测试机

8、点击build按钮来测试,按照步骤设置后,可build succeeded~

image.png

9、测试机上安装证书,执行以下命令:
xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=测试机的udid' test

如果没有报错证明安装成功,同时手机上会安装一个WebDriverAgent软件。需要在手机设置->通用->设备管理->信任开发者。如下图:
image.png
image.png

三、Appium Client端

Appium Client有Ruby,Python,Java三个版本,可自行选择自己喜欢的安装即可,本次只针对Python版安装:

pip install Appium-Python-Client


以上,接下来可以定位元素,推荐使用App Inspector,开始iOS自动化之旅吧~~

目录
相关文章
|
1月前
|
数据采集 测试技术 API
python爬虫之Appium 的使用
搭建appium环境,appium基本使用,API操作等等
44 0
|
6月前
|
Python Windows
[笔记]Python笔记之python2 windows环境搭建
[笔记]Python笔记之python2 windows环境搭建
|
4月前
|
JavaScript Java 测试技术
『App自动化测试之Appium基础篇』| 从定义、原理、环境搭建、安装问题排查等深入了解Appium
『App自动化测试之Appium基础篇』| 从定义、原理、环境搭建、安装问题排查等深入了解Appium
569 0
|
7月前
|
Linux 数据处理 iOS开发
Python空间数据处理环境搭建
常用的空间数据处理Python库 GDAL 全能型的基础空间数据处理库 fiona 基于GDAL的空间矢量数据处理库 rasterio 基于GDAL的空间栅格处理库 basemap 基于matplotlib的空间制图库 GeoPandas 基于pandas的空间数据分析库 RSGISlib 针对遥感数据及GIS分析的高级库
82 0
|
7月前
|
JSON Java 测试技术
Python + Appium 自动化操作微信入门
Python + Appium 自动化操作微信入门
138 0
|
16天前
|
数据采集 机器学习/深度学习 人工智能
Python环境搭建—安装Python3解释器
Python环境搭建—安装Python3解释器
33 2
|
1月前
|
数据采集 JSON NoSQL
python爬虫 Appium+mitmdump 京东商品
python 爬虫 Charles + appium + mitmproxy 实现 app 京东商品数据获取
32 0
|
1月前
|
人工智能 Linux 开发者
Python环境搭建:一站式指南
在当前AIGC技术蓬勃发展的背景下,Python作为人工智能领域最受青睐的编程语言之一,成为我们必须掌握的技能。因此,搭建一个适合自己的Python环境成为了每个Python开发者的首要任务。本文将为您提供一站式的Python环境搭建指南,帮助您顺利开始Python学习和开发之旅。
51 0
Python环境搭建:一站式指南
|
3月前
|
JavaScript Java 开发工具
Python+Appium2.0的APP自动化环境搭建
Python+Appium2.0的APP自动化环境搭建
111 0
|
3月前
|
Python
python 使用 AppiumService 类启动appium server
python 使用 AppiumService 类启动appium server
47 0