Appium appium 启动 问题

· 2015年07月17日 · 最后由 回复于 2016年03月10日 · 1656 次阅读

昨天试了多机运行失败后,发现之前一个简单的 demo 都不能正常运行了。

我的脚本

#coding:utf-8
from appium import webdriver
from time import sleep

desired_caps = {}
desired_caps['platformName'] = 'Android'
#desired_caps['platformVersion'] = '4.1'
desired_caps['deviceName'] = '192.168.56.101:5555'
#desired_caps['udid']='192.168.56.101:5555'
#desired_caps['automationName'] = "Selendroid"
desired_caps['platformVersion'] = '4.4'
#desired_caps['deviceName'] = 'accf99bd'
#desired_caps['app'] = 'D:\apk\TBJ_4.2.0_online_0715_1405.apk'
#desired_caps['appPackage'] = 'com.tongbanjie.android'
#desired_caps['appActivity'] = '.TBJMainFragmentActivity'
desired_caps['appPackage'] = 'com.android.calculator2'
desired_caps['appActivity'] = '.Calculator'
dr = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)

dr.find_element_by_id("com.android.calculator2:id/digit9").click()
dr.close_app()
dr.quit()


##   我的pycharm报错

```shell
C:\Python27\python.exe D:/appium/appiumtest.py
Traceback (most recent call last):
  File "D:/appium/appiumtest.py", line 18, in <module>
    dr = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
  File "C:\Python27\lib\site-packages\appium\webdriver\webdriver.py", line 35, in __init__
    super(WebDriver, self).__init__(command_executor, desired_capabilities, browser_profile, proxy, keep_alive)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 89, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 138, in start_session
    'desiredCapabilities': desired_capabilities,
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 193, in execute
    response = self.command_executor.execute(driver_command, params)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 358, in execute
    return self._request(command_info[0], url, body=data)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 426, in _request
    resp = opener.open(request)
  File "C:\Python27\lib\urllib2.py", line 431, in open
    response = self._open(req, data)
  File "C:\Python27\lib\urllib2.py", line 449, in _open
    '_open', req)
  File "C:\Python27\lib\urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "C:\Python27\lib\urllib2.py", line 1227, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "C:\Python27\lib\urllib2.py", line 1197, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [Errno 10061] >

我的 appium server 界面:

在线等,server 成功启动的,但是运行脚本后,根本没有运行 server

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
共收到 17 条回复 时间 点赞

http://127.0.0.1:4723/wd/hub 代理设置动过么?

#16 · 2015年07月17日 Author

#1 楼 @tlbin 端口动过了,我昨天 appium --port 4726 ,一个 4723 开了两个

#15 · 2015年07月17日 Author

#1 楼 @tlbin 你 qq 多少啊

#3 楼 @mads 应该把端口弄成一致的就好了吧~

另外开两个端口和更改端口 我么有尝试过···待会有空了试试

#12 · 2015年07月17日 Author

#5 楼 @tlbin 没用的、、、

  1. 直接在浏览器打开 http://127.0.0.1:4723/wd/hub 看下是否提示 That URL did not map to a valid JSONWP resource。如果显示无法打开,那就是 appium server 没有成功监听到 4723 端口。
  2. 把 appium server 的地址改成 0.0.0.0:4723 再试试。
#10 · 2015年07月18日 Author

#7 楼 @chenhengjie123 第一种是显示的。。我后来重装系统了

#8 楼 @mads ...重装系统了···也是醉了...

#8 · 2015年07月20日 Author

#9 楼 @tlbin 没办法,解决不了啊。能力不行,唉,没办法

大神能帮我处理一下这个问题吗。和 IOS 真机调试,到这里就不动了。开发者证书也已经安装了。

#11 · 2015年07月27日 Author

#11 楼 @bdyjy mac 不会

那有没有遇到过类似的问题呢。

#11 楼 @bdyjy 我遇到的问题是 appium+python 定义好的路径,无法安装.ipa。很无语

#3 · 2015年07月27日 Author

#13 楼 @bdyjy 没搭建过 mac 的环境,我不懂啊

楼主问题解决了吗

#1 · 2016年03月10日 Author

#16 楼 @plato79 几百年前的了

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册