首页 技术 正文
技术 2022年11月12日
0 收藏 444 点赞 4,017 浏览 1714 个字

原文转自http://blog.sina.com.cn/s/blog_68f262210102v538.html

一,Appium_Python_Client的安装

推荐使用pip安装

pip install Appium-Python-Client

当然了也可以在Pipy上下载源码安装

tar -xvf Appium-Python-Client-X.X.tar.gz(windows上用7zip可以解压)

cd Appium-Python-Client-X.X

python setup.py install

最后,也可以通过github安装(要git客户端)

git clone git@github.com:appium/python-client.git

cd python-client

python setup.py install

二,Appium_Python_Client介绍

Appium的实用方法都藏在Client的源码里,对于driver和webelement实例,均有对应的元素查找方法(webelement查找的是下面的子元素),有些儿专门针对手机的函数,则需要在这个Client安装后方可使用。

(以下内容转自:http://testerhome.com/topics/1166

appium为了实现自己的find查找方式,首先自定义了一个MobileBy类,给这个类对象塞入了它定义的一些扩展属性,这些属性的值会通过webdriver协议推送到server端去识别和执行,为了让这些属性运用到find方法中,appium很好地继承和扩展了webdriver.Remote,然后通过调用driver实例的find_element和find_elements两个核心方法实现元素查找,所以,既然是扩展,appiumdriver实例可以使用seleniumdriver的所有关于元素查找的实例方法,他们的列表我们就可以整理出来了

seleniumdriver

find_element_by_id
find_elements_by_id
find_element_by_name
find_elements_by_name
find_element_by_link_text
find_elements_by_link_text
find_element_by_partial_link_text
find_elements_by_partial_link_text
find_element_by_tag_name
find_elements_by_tag_name
find_element_by_xpath
find_elements_by_xpath
find_element_by_class_name
find_elements_by_class_name
find_element_by_css_selector
find_elements_by_css_selector

appiumdriver

find_element_by_ios_uiautomation
find_elements_by_ios_uiautomation
find_element_by_android_uiautomator
find_elements_by_android_uiautomator
find_element_by_accessibility_id
find_elements_by_accessibility_id

三,Appium_Python_Client的使用

安装完成后,要引用一下才可以使用。我们通常引用webdriver的时候是使用下面的命令的:

From selenium import webdriver

可是我们要使用appium_python_client中的函数,就要改成下面的引用方法:

From appium import webdriver

然后在setup()函数中再初始化driver如下:

self.driver=webdriver.Remote(‘http://localhost:4723/wd/hub’,desired_caps)

引时便可以调用appium的专用方法了!!

 

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,083
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,558
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,407
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,180
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,817
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,900