该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

appium1.15

Python3.7

安卓设备:5.1.1

定位时报错,找不到元素

配置:desired_caps = {}

desired_caps['platformName'] = 'Android' # 设备系统

desired_caps['platformVersion'] = '5.1.1' # 设备系统版本号

desired_caps['deviceName'] = '127.0.0.1:62001' # 设备名称

# desired_caps['app'] = 'F:// debug.apk' # 要测试的应用的地址

desired_caps['appPackage'] = 'uni.UNI5BEADCA' # 应用的包名

desired_caps['automationName'] = 'uiautomator2'

desired_caps['appActivity'] = 'io.dcloud.PandoraEntryActivity'

定位:toast_element = ("xpath", ".//*[contains(@text,'该账户未注册')]")

el = WebDriverWait(self.driver, 3, 0.1).until(EC.presence_of_element_located(toast_element))

print(el.text)

报错:

[HTTP] --> POST /wd/hub/session/3a391b2e-584f-45fe-a059-d2beca78b429/element[HTTP] {"using":"xpath","value":"//*[contains(@text,'该账户未注册')]"}[W3C (3a391b2e)] Calling AppiumDriver.findElement() with args: ["xpath","//*[contains(@text,'该账户未注册')]","3a391b2e-584f-45fe-a059-d2beca78b429"][BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator[BaseDriver] Waiting up to 8000 ms for condition[WD Proxy] Matched '/element' to command name 'findElement'[WD Proxy] Proxying [POST /element] to [POST http://localhost:8204/wd/hub/session/c06b8ce5-aaa3-4903-b247-4c5fe8b2eb8e/element] with body: {"strategy":"xpath","selector":"//*[contains(@text,'该账户未注册')]","context":"","multiple":false}[WD Proxy] Got an unexpected response with status 404: {"sessionId":"c06b8ce5-aaa3-4903-b247-4c5fe8b2eb8e","value":{"error":"no such element","message":"An element could not be located on the page using the given search parameters","stacktrace":"io.appium.uiautomator2.common.exceptions.ElementNotFoundException: An element could not be located on the page using the given search parameters\n\tat io.appium.uiautomator2.handler.FindElement.findElement(FindElement.java:102)\n\tat io.appium.uiautomator2.handler.FindElement.safeHandle(FindElement.java:72)\n\tat io.appium.uiautomator2.handler.request.SafeRequestHandler.handle(SafeRequestHandler.java:38)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleRequest(AppiumServlet.java:252)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:242)\n\tat io.appium.uiautomator2.http.ServerHandler.channelRead(ServerHandler.java:44)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)\n\tat io.netty.channel.AbstractChannelHandlerCon...[W3C] Matched W3C error code 'no such element' to NoSuchElementError[BaseDriver] Waited for 840 ms so far[WD Proxy] Matched '/element' to command name 'findElement'[WD Proxy] Proxying [POST /element] to [POST http://localhost:8204/wd/hub/session/c06b8ce5-aaa3-4903-b247-4c5fe8b2eb8e/element] with body: {"strategy":"xpath","selector":"//*[contains(@text,'该账户未注册')]","context":"","multiple":false}[WD Proxy] Got an unexpected response with status 404: {"sessionId":"c06b8ce5-aaa3-4903-b247-4c5fe8b2eb8e","value":{"error":"no such element","message":"An element could not be located on the page using the given search parameters","stacktrace":"io.appium.uiautomator2.common.exceptions.ElementNotFoundException: An element could not be located on the page using the given search parameters\n\tat io.appium.uiautomator2.handler.FindElement.findElement(FindElement.java:102)\n\tat io.appium.uiautomator2.handler.FindElement.safeHandle(FindElement.java:72)\n\tat io.appium.uiautomator2.handler.request.SafeRequestHandler.handle(SafeRequestHandler.java:38)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleRequest(AppiumServlet.java:252)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:242)\n\tat io.appium.uiautomator2.http.ServerHandler.channelRead(ServerHandler.java:44)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)\n\tat io.netty.channel.AbstractChannelHandlerCon...[W3C] Matched W3C error code 'no such element' to NoSuchElementError

python uiautomator2 toast_appium+uiautomator2定位toast元素失败,求解决方案相关推荐

  1. Python selenium根据class定位页面元素,xpath定位

    Python selenium根据class定位页面元素 在日常的网页源码中,我们基于元素的id去定位是最万无一失的,id在单个页面中是不会重复的.但是实际工作中,很多前端开发人员并未给每个元素都编写 ...

  2. python做自动化如何定位动态元素_python-web自动化-元素定位

    # -*- coding:utf-8 -*- from selenium import webdriver from selenium.webdriver.common.by import By # ...

  3. 服务器安装操作系统失败,Installservices 服务器运行失败求解决方案

    曾经删除过SA,SAM文件是保存用户密码的数据库文件,删除后,所有的用户信息就会丢失,而相应的组信息也会随之丢失,虽然重新登录过系统,系统已经重新建立了SAM文件,也重新安装了IIS,IWAM帐号也已 ...

  4. 软件测试 app自动化03 toast元素的定位 滑屏操作 触屏操作

    文章目录 1 toast元素的定位 2 滑屏操作 2.1 坐标 2.2 滑屏分类 3 触屏操作 3.1 查看元素坐标 3.2 例子 小结 1 toast元素的定位 toast元素就是建议的消息提示框, ...

  5. python selenium定位元素方法,python + selenium 练习篇 - 定位元素的方法

    1.利用ID定位元素(能直接通过ID来定位的元素比较少) # coding=utf-8 from selenium import webdriver driver = webdriver.Chrome ...

  6. python自动化等待时间_python+appium 自动化测试 - 元素等待

    该篇文章主要用于整理的是在执行自动化测试过程中的几种元素等待方法 implicity_wait() sleep() wait_activity() 等待某元素出现后,再执行操作 WebDriverWa ...

  7. python(十二)Uiautomator2搭建UI自动化框架实战

    前言 由于公司UI自动化框架底层用的是Uiautomator2,所以我就用Uiautomator2搭了一套UI自动化框架,并运用某软件做了一个实战,思路其实和之前写的Appnium一样的 ps:这里其 ...

  8. python xpath定位打印元素_python基础教程:8种selenium元素定位的实现

    前言 selenium是一个非常厉害的爬虫利器,不,简直是神器了,它可以自动的控制浏览器,但是你得告诉浏览器,你想干嘛,爬哪里,这时候就要用到元素定位了,在HTML中都有着不同的标签和属性,selen ...

  9. python元素定位input button_python+selenium 定位到元素,无法点击的解决方法

    报错 selenium.common.exceptions.WebDriverException: Message: Element is not clickable at point (234.75 ...

最新文章

  1. fatfree-f3小型php框架(二)
  2. python卸载opencv_怎么为python安装新版的opencv模块-百度经验
  3. 超过efficientnet
  4. OpenGL的几何变换4之内观察全景图
  5. java写微信小程序答辩问题_微信小程序毕业设计选题和毕业论文怎么写,答辩流程是怎样的?...
  6. 语音识别真的比肩人类了?听听阿里iDST初敏怎么说
  7. Microsoft Visual C++ Runtime Library 错误解决办法
  8. java和asp.net core_干货分享:ASP.NET CORE(C#)与Spring Boot MVC(JAVA)异曲同工的编程方式总结...
  9. MySQL-事务的实现-redo
  10. [转载]Qt之解决中文乱码_vortex_新浪博客
  11. Spring 计划 7.0
  12. java砖头铺路面试题,Java基础知识面试题
  13. Remoting事件序列一:客户端触发服务器端事件
  14. #include“stdafx.h”详解
  15. 爬取QQ空间说说及简易数据分析
  16. BootCDN——React入门学习
  17. android没有adm_这可能是安卓平台上最好的下载器:ADM
  18. 计算机安全模式无法启动修复,win7系统崩溃无法修复和进入安全模式的解决方法...
  19. 第一次接触,两眼一抹黑。我只是想下载个小小小的文件而已啊,脑壳疼。。
  20. 新手站长做网站SEO的无奈与煎熬

热门文章

  1. mybatis-mapper
  2. VMware备份研究
  3. 讲解JS的promise,这篇是专业认真的!
  4. weblogic公布的项目用途myeclipse正常启动,点击startWeblogic.cmd报错解决方案
  5. nullnullHandling the Results 处理结果
  6. 核弹级漏洞!我把log4j扒给你看!
  7. DevOps 的发展史
  8. 高并发存储番外篇:Redis套路,一网打尽
  9. 非著名架构师告诉你,代码该如何写,才能自己写的容易别人看的也不痛苦
  10. 关于分库分表,这有一套大而全的轻量级架构设计思路