本文将介绍带有“span:contains的详细情况,特别是关于'string'”的selenium.common.exceptions.InvalidSelectorException的相关信息。我
本文将介绍带有“ span:contains的详细情况,特别是关于'string'”的selenium.common.exceptions.InvalidSelectorException的相关信息。我们将通过案例分析、数据研究等多种方式,帮助您更全面地了解这个主题,同时也将涉及一些关于Appium问题解决方案(4)- selenium.common.exceptions.InvalidSelectorException: Message: Locator Strategy 、Appium问题解决方案(5)- selenium.common.exceptions.InvalidSelectorException: Message: Locator Strategy 'name' is not supported for this session、c3p0 连接池:com.mysql.cj.exceptions.InvalidConnectionAttributeException、com.mysql.cj.core.exceptions.InvalidConnectionAttributeException: The server time zone value ''...的知识。
本文目录一览:- 带有“ span:contains('string')”的selenium.common.exceptions.InvalidSelectorException
- Appium问题解决方案(4)- selenium.common.exceptions.InvalidSelectorException: Message: Locator Strategy
- Appium问题解决方案(5)- selenium.common.exceptions.InvalidSelectorException: Message: Locator Strategy 'name' is not supported for this session
- c3p0 连接池:com.mysql.cj.exceptions.InvalidConnectionAttributeException
- com.mysql.cj.core.exceptions.InvalidConnectionAttributeException: The server time zone value ''...
带有“ span:contains('string')”的selenium.common.exceptions.InvalidSelectorException
我正在使用Firefox中的Selenium python。我正在尝试通过CSS选择器查找元素
element = "span:contains(''Control panel'')"my_driver.find_element_by_css_selector(element)
我低于错误
raise exception_class(message, screen, stacktrace)selenium.common.exceptions.InvalidSelectorException: Message: Given css selector expression "span:contains(''Control panel'')" is invalid: InvalidSelectorError: ''span:contains(''Control panel'')'' is not a valid selector: "span:contains(''Control panel'')"
在Selenium IDE中,我可以通过此字段成功找到元素,但是在Python中,它不起作用
答案1
小编典典css_selector
Selenium不支持使用按文本定位元素(尽管它可以在开发人员工具控制台中使用)。唯一的可能性是xpath
element = "//span[contains(text(), ''Control panel'')]"my_driver.find_element_by_xpath(element)
编辑:@FlorentB的评论:
css selector
控制台也不支持A
,但是JQuery支持它。$(''...'')
控制台中的from是该页面的缩写,document.querySelector
通常会被JQuery覆盖。
Appium问题解决方案(4)- selenium.common.exceptions.InvalidSelectorException: Message: Locator Strategy
背景
使用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
背景
使用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全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
原文地址:https://www.cnblogs.com/poloyy
c3p0 连接池:com.mysql.cj.exceptions.InvalidConnectionAttributeException
1 遇到的错误 com.mysql.cj.exceptions.InvalidConnectionAttributeException:
1 四月 17, 2019 10:21:13 上午 com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager
2 信息: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 2udui8a2beimx6x8ptry|2f4d3709, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 2udui8a2beimx6x8ptry|2f4d3709, idleConnectionTestPeriod -> 0, initialPoolSize -> 20, jdbcUrl -> jdbc:mysql://localhost:3306/test, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 30, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 30, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 10, numHelperThreads -> 3, numThreadsAwaitingCheckoutDefaultUser -> 0, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false ]
3 Loading class `com.mysql.jdbc.Driver''. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver''. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
4 四月 17, 2019 10:21:33 上午 com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector run
5 警告: com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@26aa877c -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
6 四月 17, 2019 10:21:33 上午 com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector run
7 警告: com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@26aa877c -- APPARENT DEADLOCK!!! Complete Status:
8 Managed Threads: 3
9 Active Threads: 3
10 Active Tasks:
11 ....
12 Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value ''???ú±ê×??±??'' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.
13 at sun.reflect.GeneratedConstructorAccessor32.newInstance(Unknown Source)
14 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
15 at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
16 at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
17 at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:85)
18 at com.mysql.cj.util.TimeUtil.getCanonicalTimezone(TimeUtil.java:132)
19 at com.mysql.cj.protocol.a.NativeProtocol.configureTimezone(NativeProtocol.java:2234)
20 at com.mysql.cj.protocol.a.NativeProtocol.initServerSession(NativeProtocol.java:2258)
21 at com.mysql.cj.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:1319)
22 at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:966)
23 at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:825)
24 ... 11 more
2 解析
参考博客地址:https://blog.csdn.net/weixin_37577564/article/details/80329775
the server time zone value ''???ú±ê×??±??'' is unrecognized or represents more than one time zone.
出现这个的原因是因为 mysql 返回的时间总是有问题,比实际时间要早 8 小时。
在 jdbc 连接的 url 后面加上 serverTimezone=GMT 即可解决问题,如果需要使用 gmt+8 时区,需要写成 GMT%2B8
3 解决方法
注意:首先检查 mysql-connector-java-xxx.jar 的版本,若过低,升成 8.0.13
3.1 如果是在 Java 工具类里:
dataSource.setJdbcUrl("jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=false");
3.2 如果是在配置文件里:
<property name="jdbcUrl">jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=false</property>
以上,吼吼
com.mysql.cj.core.exceptions.InvalidConnectionAttributeException: The server time zone value ''...
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<druid.version>1.0.9</druid.version>
<mybatis.boot.starter.version>1.3.0</mybatis.boot.starter.version>
<mysql.connector.java.version>8.0.15</mysql.connector.java.version>
</properties>
datasource:
url: jdbc:mysql://localhost:3306/db_pack_case?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
username: root
password: root
driver-class-name: com.mysql.cj.jdbc.Driver
今天关于带有“ span:contains和'string'”的selenium.common.exceptions.InvalidSelectorException的分享就到这里,希望大家有所收获,若想了解更多关于Appium问题解决方案(4)- selenium.common.exceptions.InvalidSelectorException: Message: Locator Strategy 、Appium问题解决方案(5)- selenium.common.exceptions.InvalidSelectorException: Message: Locator Strategy 'name' is not supported for this session、c3p0 连接池:com.mysql.cj.exceptions.InvalidConnectionAttributeException、com.mysql.cj.core.exceptions.InvalidConnectionAttributeException: The server time zone value ''...等相关知识,可以在本站进行查询。
本文标签: