这么好的帖子,感谢大佬
感觉 appium 群众基础更大一些吧
谢谢大佬,我研究一下这个文件
我安装了最新的版本,但是还是不支持 Android10 呀。一直报错:
2020-02-27T08:25:03.538Z FTL/util:lifecycle 33358 [2KE0219A31008451] Shutting down due to fatal error
2020-02-27T08:25:03.547Z INF/provider 33322 [] Cleaning up device worker "2KE0219A31008451"
2020-02-27T08:25:03.547Z ERR/provider 33322 [] Device worker "2KE0219A31008451" died with code 1
从自己的平台直接跳转到设备控制的页面,想把 stf 改成免登陆,然后怎么从设备列表进去设备控制页,或者看您之前的回复免登录之后直接调用接口嘛?
加群了,楼主同意一下呀
楼主,我小米和魅族手机也遇到这些问题,提示:2019-12-13T03:56:23.292Z FTL/device 99797 [qc6hz5rs99lnswgq] Setup had an error Error: Failed more than 3 times in 10000ms
自启动已经打开,小米手机安全设置也打开了,但是还是这个报错
有没有大佬遇到过这两个手机
你好,我的红米手机也遇到这个问题,请问现在解决了嘛,APK 安装上了,而且安全设置也打开了
我进入到 stf 的目录,执行了一下 npm install,多执行几次就好了
就是用 app-inspector 看 UI 树状图,可以直接看到定位到 webview 的元素,但是我用 appium 启动找不到这个元素,提示我遇到的这个错误,xpath、text、坐标点击都用到了,就是不能在这个 webview 上用 appium 来进行操作
加了之后启动报错:selenium.common.exceptions.WebDriverException: Message: No such context found.,可以加下您 QQ 或者微信问您吗
当前页面其他非 webview 可以用 xpath 定位,就是 webview 上的元素不能点击,坐标点击也不能点击,就是对 webview 上的元素操作不了,打印上下文 contexts 就只有 native_app,没有 webview 相关
pagesource 打印是能找到元素的,我用 WebDriverWait 试了也是报错,提示找不到元素
有没有大佬来帮帮我
这是 appium 日志的报错:
[HTTP] {"using":"xpath","value":"//android.support.v4.view.ViewPager[1]/android.widget.RelativeLayout[1]/android.webkit.WebView[1]/android.webkit.WebView[1]/android.view.View[1]/android.view.View[1]/android.view.View[1]/android.view.View[1]/android.view.View[2]/android.widget.ListView[1]/android.view.View[1]/android.widget.GridView[2]/android.view.View[1]/android.view.View[3]","sessionId":"d4433388-3306-4810-b75d-a22905514d93"}
[debug] [W3C (d4433388)] Calling AppiumDriver.findElement() with args: ["xpath","//android.support.v4.view.ViewPager[1]/android.widget.RelativeLayout[1]/android.webkit.WebView[1]/android.webkit.WebView[1]/android.view.View[1]/android.view.View[1]/android.view.View[1]/android.view.View[1]/android.view.View[2]/android.widget.ListView[1]/android.view.View[1]/android.widget.GridView[2]/android.view.View[1]/android.view.View[3]","d4433388-3306-4810-b75d-a22905514d93"]
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [WD Proxy] Matched '/element' to command name 'findElement'
[debug] [WD Proxy] Proxying [POST /element] to [POST http://localhost:8257/wd/hub/session/56592bc2-90df-486a-b370-785de3a90a87/element] with body: {"strategy":"xpath","selector":"//android.support.v4.view.ViewPager[1]/android.widget.RelativeLayout[1]/android.webkit.WebView[1]/android.webkit.WebView[1]/android.view.View[1]/android.view.View[1]/android.view.View[1]/android.view.View[1]/android.view.View[2]/android.widget.ListView[1]/android.view.View[1]/android.widget.GridView[2]/android.view.View[1]/android.view.View[3]","context":"","multiple":false}
[WD Proxy] Got an unexpected response: {"sessionId":"56592bc2-90df-486a-b370-785de3a90a87","status":7,"value":"An element could not be located on the page using the given search parameters."}
[debug] [MJSONWP] Matched JSONWP error code 7 to NoSuchElementError
[debug] [W3C (d4433388)] Encountered internal error running command: NoSuchElementError: An element could not be located on the page using the given search parameters.
[debug] [W3C (d4433388)] at AndroidUiautomator2Driver.findElOrEls (/usr/local/homebrew/lib/node_modules/appium/node_modules/appium-android-driver/lib/commands/find.js:75:11)
[debug] [W3C (d4433388)] at <anonymous>
[HTTP] <-- POST /wd/hub/session/d4433388-3306-4810-b75d-a22905514d93/element 404 635 ms - 416
[HTTP]
这个是控制台的报错:
Traceback (most recent call last):
File "/Users/liyaoyao/Documents/basebbs-all-autotest/iOSAutoTest/iOSAppiumTest/Android.py", line 26, in <module>
browser.find_element_by_xpath("//android.support.v4.view.ViewPager[1]/android.widget.RelativeLayout[1]/android.webkit.WebView[1]/android.webkit.WebView[1]/android.view.View[1]/android.view.View[1]/android.view.View[1]/android.view.View[1]/android.view.View[2]/android.widget.ListView[1]/android.view.View[1]/android.widget.GridView[2]/android.view.View[1]/android.view.View[3]").click()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 394, in find_element_by_xpath
return self.find_element(by=By.XPATH, value=xpath)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/appium/webdriver/webdriver.py", line 258, in find_element
'value': value})['value']
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/appium/webdriver/errorhandler.py", line 29, in check_response
raise wde
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/appium/webdriver/errorhandler.py", line 24, in check_response
super(MobileErrorHandler, self).check_response(response)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: An element could not be located on the page using the given search parameters.
我 pagesource 也是可以打印 webview 中的元素的,但是 driver.find_element 就是一直提示找不到
我按照教程按照了,npm install 也没有报错,然后启动的时候报一堆错误,是需要重新再安装 sudo npm install -g stf 吗?还是别的步骤不对
stf 支持 iOS13 吗
对呀,不关掉 macaca 的 app-inspector 会起冲突,不知道还有什么方法比较友好的可以获取 iOS 和 Android 的 UI 树状图
或者说除了 app-inspector 还有其他查看元素的,网页的这种
我试过 subprocess.Popen 去启动命令,还是不能多进程并发,我的启动代码张这样
def start_appium():
post_num = 4723
wad = 8010
while check_port(post_num):
post_num = post_num + 2
while check_port(wad):
wad = wad + 1
# 根据系统,启动对应的服务
cmd_dict = {
'MAC': f'appium -a 127.0.0.1 -p {post_num} --webdriveragent-port {wad} --log xxx.log --local-timezone & '
}
#os.system(cmd_dict['MAC'])
subprocess.Popen(cmd_dict['MAC'], shell=True)
time.sleep(5) # 等待启动完成
print('appium 启动成功')
return post_num
我之前看文章,Windows 上可以直接用 start /b 去开启新窗口,但是 Mac 没有这个命令,试过 subprocess.Popen 也不行,手动打开终端去开启几个服务这样并发我之前一直上这么做的,现在就想实现用时再启动
我是 Mac 系统,所以 start 命令提示找不到,在 Mac 中有没有类似于 start 命令的指令呀,还有我试了一下自带的 AppiumServer,
service = AppiumService()
service.start(args=['--address', '127.0.0.1', '-p', '4723'], timeout_ms=2000) 一直报错,:
File "/Users/hpcl201901056/Documents/Autotest_platform/Autotest_platform/helper/util.py", line 86, in start_appium
service.start(args=['--address', '127.0.0.1', '-p', '4723'], timeout_ms=2000)
File "/Users/hpcl201901056/Documents/Autotest_platform/venv/lib/python3.6/site-packages/appium/webdriver/appium_service.py", line 159, in start
main_script = kwargs['main_script'] if 'main_script' in kwargs else self._get_main_script()
File "/Users/hpcl201901056/Documents/Autotest_platform/venv/lib/python3.6/site-packages/appium/webdriver/appium_service.py", line 105, in _get_main_script
raise AppiumServiceError(e.output)
appium.webdriver.appium_service.AppiumServiceError: b''
我测试过程中发现需要开两个终端窗口开启新进程,两台 iOS 设备才能并发运行,所以想问一下,怎么用脚步开启一个新窗口进程启动服务
还有怎么多进程启动 appium 服务呀