背景

使用Appium Server 1.15.1版本

执行了以下脚本

test = driver.find_element_by_name("自动化测试")
print(test.text)

报了以下错误

圈重点

selenium.common.exceptions.InvalidSelectorException: Message: Locator Strategy 'name' is not supported for this session

简译:  by_name 这种定位元素方式已经不支持了

然后查了下资料,发现是在appium1.5之后, by_name 的这种定位方式已经彻底移除

解决方法一

最简单,不再用 by_name 定位方式了,改用id、class、xpath、accessibility id

解决方法二

看了网上的教程【driver.js】,最终发现也是没用的,这里就不展开了~还是换个定位方式叭!

Appium问题解决方案(5)- selenium.common.exceptions.InvalidSelectorException: Message: Locator Strategy 'name' is not supported for this session的更多相关文章

  1. selenium的报错信息:selenium.common.exceptions.InvalidSelectorException: Message: invalid selector: Compound class names not permitted

    报错信息:selenium.common.exceptions.InvalidSelectorException: Message: invalid selector: Compound class ...

  2. Appium新版本遇到的问题,不能通过 name 去定位元素抛 Message: Locator Strategy 'name' is not supported for this session

    环境: 1.Appium: 1.15.1 2.Python: 3.7.0 3.Selenium: 3.141.0 4.IDE: Pycharm 5.PC:Windows 10 问题:在 Pycharm ...

  3. 【Seleniuem】selenium.common.exceptions.InvalidSelectorException

    selenium.common.exceptions.InvalidSelectorException: Message: invalid selector: An invalid or illega ...

  4. Appium问题解决方案(8)- selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Could not sign with default certificate.

    背景 运行时代码报错: selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occ ...

  5. appium selenium.common.exceptions.WebDriverException: Message: Parameters were incorrect

    selenium.common.exceptions.WebDriverException: Message: Parameters were incorrect. We wanted {" ...

  6. selenium.common.exceptions.WebDriverException: Message: unknown Error: cannot find Chrome binary

    使用Chrome浏览器时,经常会遇到以下报错:浏览器没有调用起来 selenium.common.exceptions.WebDriverException: Message: unknown Err ...

  7. python + web自动化,点击不生效,提示“selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element is not clickable at point (117, 674)”

    前言: 在做web自动化时,遇到一个缩放了浏览器比例的操作,从100%缩小到80%,再进行点击的时候,弹出报错信息,无法点击 selenium.common.exceptions.ElementCli ...

  8. selenium.common.exceptions.TimeoutException: Message: Screenshot: available via screen

    在使用selenium+phantomjs的时候在Windows平台下能够正常工作,在Linux下却不能,并得到错误信息: selenium.common.exceptions.TimeoutExce ...

  9. selenium使用遇到的问题(selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH.)

    1.安装pip3 install selenium 2.使用browser=webdriver.Chrome()时报错 :selenium.common.exceptions.WebDriverExc ...

随机推荐

  1. CF427B

    没人用ST表么?他比线段树快. 考虑先把ST表跑下来,然后循环一遍区间的起点,看一下这个区间的最大值,和 \(t\) 比较一下即可. 然后这题就做完了.ST表裸题. int f[2000010][21 ...

  2. linux服务器下TCP抓包

    1.首先ifconfig查看当前服务器的网卡信息 2.执行tcpdump -i ens160[网卡信息] -s 0 port 8080[监听的端口号] -w ./fileName.pcapng 3.可 ...

  3. 在 CSS 中表示颜色的hex code方法和rgb方法

    hexadecimal code(十六进制编码),简写为 hex code. 我们通常使用 decimals,也就是十进制数字,它对每一位数字使用符号0到9来表示.Hexadecimals (或 he ...

  4. Git-09-常用命令

    git常用命令 一般来说,日常使用只要记住下图6个命令,就可以了.但是熟练使用,恐怕要记住60-100个命令 下面是我整理的常用 Git 命令清单.几个专用名词的译名如下. Workspace:工作区 ...

  5. SQL 练习40

    按照出生日期来计算学生的年龄信息 IF OBJECT_ID('GetStudentAge','FN') IS NOT NULL DROP FUNCTION GetStudentAge GO CREAT ...

  6. NOIP 模拟 $31\; \rm Time$

    题解 \(by\;zj\varphi\) 考虑如何才能最优. 每次一定把当前最小值移动到边界上,那么看它向左还是向右移更优. 用树状数组维护一下即可,复杂度 \(\mathcal O\rm (nlog ...

  7. redis的五大数据类型实现原理

    1.对象的类型与编码 Redis使用前面说的五大数据类型来表示键和值,每次在Redis数据库中创建一个键值对时,至少会创建两个对象,一个是键对象,一个是值对象,而Redis中的每个对象都是由 redi ...

  8. SpringBoot集成websocket(Spring方式)

    SpringWebSocketConfig配置 package com.meeno.chemical.socket.task.config; import com.meeno.chemical.soc ...

  9. C++ 计算MD5

    头文件: #pragma once #ifndef MD5_H #define MD5_H #include <string> #include <fstream> /* Ty ...

  10. 【转】CAP定理的含义

    转自:https://blog.csdn.net/pengjunlee/article/details/86517935 1998年,加州大学的计算机科学家 Eric Brewer 提出了分布式系统的 ...