Appium appium python+pycharm 的一些问题

zhangmin · March 23, 2016 · Last by 成依纯 replied at July 20, 2016 · 1715 hits

我使用的 mac 环境,已经配置好了 appium 的环境

现在想使用 python 作为编写的语言,但是遇到了以下这个问题。我使用的是 python 的 pycharm 这个编辑器,在导入 appium 的包的时候


ide 里面并没有这个 appium webdriver 的东西。所以我想问下,怎么样才能导入呢?

共收到 17 条回复 时间 点赞

appium 的 python client api 没安装啊

pip install Appium-Python-Client

不要截图。。。请直接粘贴日志

#2 楼 @monkey 好的清楚了

教程没好好看呐

#1 楼 @among29

$ pip install Appium-Python-Client
Requirement already satisfied (use --upgrade to upgrade): Appium-Python-Client in /Library/Python/2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): selenium>=2.47.0 in /Library/Python/2.7/site-packages/selenium-2.52.0-py2.7.egg (from Appium-Python-Client)
Cleaning up...

给出的提示是这个

#2 楼 @among29 在 cmd 命令行中是可以导入成功的,就是在 pycharm 中不行所以想问的是怎么导入

#4 楼 @neyo

$ python
Python 2.7.10 (default, Oct 23 2015, 18:05:06) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from appium import webdriver
>>> 

cmd 是好的

#7 楼 @struggle 你电脑上装了几个版本的 python,是不是 project interpreter 不对了

会不会。。是你的脚本名称有叫"appium"的

zhangmin #10 · March 23, 2016 Author

#8 楼 @neyo 恩,我找到问题了。mac 安装了两个版本的 python,我安装的 appium 的包默认在 2.7 版本里面,但是实际 pycharm 创建项目的时候默认的是 2.6 的版本所以错了这个问题。非常感谢!!

#10 楼 @struggle 解决了就好,不客气😄

#10 楼 @struggle 建议使用 python 的 virtualenv 维护 python 的环境,避免依赖污染到你 mac 系统中的全局 python 环境

desired_capabilities['appPackage'] = 'com.android.calculator2'
desired_capabilities['appActivity'] = '.Calculator'
请问这两句什么意思

我也遇到这个问题了,我的是又从 PyCham 的 Preference 中找到工程,重新设置的 Project Interpreter 才好。但是在下边 External Libraries 中 Appium_Python_Client 图标上有个小锁,不知道是为什么

def test_gestureUnlock(self):
#time.sleep(5)
el1 = self.driver.find_element_by_xpath("//UIAApplication[1]/UIAWindow[1]/UIAButton[10]")
print el1
time.sleep(2)
el2 = self.driver.find_element_by_xpath("//UIAApplication[1]/UIAWindow[1]/UIAButton[13]")
print el2
time.sleep(2)
el3 = self.driver.find_element_by_xpath("//UIAApplication[1]/UIAWindow[1]/UIAButton[16]")
print el3
time.sleep(2)
el4 = self.driver.find_element_by_xpath("//UIAApplication[1]/UIAWindow[1]/UIAButton[17]")
print el4
time.sleep(2)
Gesture = TouchAction().press(el1).move_to(el2).move_to(el3).move_to(el4).release()
print Gesture
time.sleep(2)
Gesture.perform()

请问 手势密码这一段有什么问题啊 一直提示如下错误:

File "/Library/Python/2.7/site-packages/appium/webdriver/common/touch_action.py", line 94, in perform
self._driver.execute(Command.TOUCH_ACTION, params)
AttributeError: 'NoneType' object has no attribute 'execute'

#10 楼 @struggle 解决了 谢谢


LZ 我自己写的代码提示的是这个,请问下你知道是什么原因吗?

需要 Sign In 后方可回复, 如果你还没有账号请点击这里 Sign Up