原文转自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的专用方法了!!

 

最新文章

  1. android studio 不能创建或者安装模拟器
  2. 华为oj 购物单
  3. Linux常用命令及shell脚本
  4. UIAlertController、UIAlertAction 警告框
  5. jq中阻止元素的默认行为
  6. hdoj 2682 Tree
  7. 实例源码--Android智能家居系统源码
  8. MySQL基础 (DML)
  9. 使用HttpWebRequest进行请求时发生错误:基础连接已关闭,发送时发生错误处理
  10. zabbix linux被监控端部署
  11. 移动webapp的那些bug
  12. 将Word表格中单元格中的文字替换成对应的图片
  13. VirtualBox虚拟机网络设置说明
  14. [MicroPython]TPYBoardv102播放音乐实例
  15. Luogu P1439 【模板】最长公共子序列
  16. 剑指offer-整数中1出现的次数
  17. HDFS Lease Recovey 和 Block Recovery
  18. std::max、std::min error C2589: “(”:“::”右边的非法标记,error C2059: 语法错误:“::”
  19. LOJ #2145. 「SHOI2017」分手是祝愿
  20. 打开yii2控制台命令

热门文章

  1. 如何使用OpenCart 2.x Event事件系统
  2. (转) bicabo Visual Studio 2012自动添加注释(如版权信息等)
  3. 【知识总结】CSS中样式覆盖优先顺序
  4. 20145221 《Java程序设计》第二周学习总结
  5. kali_install_complete_no_sound
  6. jz2440-uboot-201204版本移植【学习笔记】【原创】
  7. Ubuntu 安装zookeeper
  8. AngularJs 表单提交按钮状态
  9. Coursera SDN M1.2.1 SDN History: Programmable Networks 1
  10. GetLastError()数字_转换为_文字