Compound class names are not supported. Consider searching for one class name and filtering the results
原文地址:http://stackoverflow.com/questions/20361643/compound-class-names-are-not-supported-consider-searching-for-one-class-name-an
使用webdriver定位元素方法By.ClassName("btn-buy jq-productdetail-buy")时报的错误,查找到上述资料,说是因为中间的空格,它会识别为两个元素,而如果这样定位By.ClassName("btn-buy"),则会定位到classname包含btn-buy的所有元素的第一个,所以解决方案如下:
CssSelector (the best):
driver.FindElement(By.CssSelector(".bighead.crb")); // flexible, match "bighead small crb", "bighead crb", "crb bighead", etc.
driver.FindElement(By.CssSelector("[class*='bighead crb']")); // order matters, match class contains "bighead crb"
driver.FindElement(By.CssSelector("[class='bighead crb']")); // match "bighead crb" strictly
XPath (the better):
driver.FindElement(By.XPath(".//*[contains(@class, 'bighead') and contains(@class, 'crb')]")); // flexible, match "bighead small crb", "bighead crb", "crb bighead", etc.
driver.FindElement(By.XPath(".//*[contains(@class, 'bighead crb')]")); // order matters, match class contains string "bighead crb" only
driver.FindElement(By.XPath(".//*[@class='bighead crb']")); // match class with string "bighead crb" strictly
Compound class names are not supported. Consider searching for one class name and filtering the results的更多相关文章
- 【Selenium专题】 FAQ_对象识别_Compound class names are not supported
测试代码 public void login(){ WebDriver driver = new ChromeDriver(); driver.get("http://IP:Port/cli ...
- selenium的报错信息:selenium.common.exceptions.InvalidSelectorException: Message: invalid selector: Compound class names not permitted
报错信息:selenium.common.exceptions.InvalidSelectorException: Message: invalid selector: Compound class ...
- InvalidSelectorError: Compound class names not permitted报错处理
InvalidSelectorError: Compound class names not permitted报错处理 环境:python3.6 + selenium 3.11 + chromed ...
- selenium实战-Compound class names not permitted
这个复合类其实就是嵌套类,使用最后一个作为类名即可
- java-selenium(一)元素定位
在定位单个元素时,selenium-webdriver 提示了如下一些方法对元素进行定位.下面这些定位方式中,优先使用 id.name.classname,对于网上的链接元素,推荐使用linkText ...
- 译:Spring框架参考文档之IoC容器(未完成)
6. IoC容器 6.1 Spring IoC容器和bean介绍 这一章节介绍了Spring框架的控制反转(IoC)实现的原理.IoC也被称作依赖注入(DI).It is a process wher ...
- Spring4参考手册中文版
Spring4参考手册中文版 前言 https://github.com/b2gats/stone-docs/blob/master/spring-4-beans.md Part III. 核心技术 ...
- python查找时,不支持compound class
1.python使用如下代码查找页面上的元素时, browser.findElement_by_class_name("widget-content nopadding") 报错: ...
- Sphinx 2.2.11-release reference manual
1. Introduction 1.1. About 1.2. Sphinx features 1.3. Where to get Sphinx 1.4. License 1.5. Credits 1 ...
随机推荐
- Zedboard甲诊opencv图像处理(三)
整个工程进展到这一步也算是不容易吧,但技术含量也不怎么高,中间乱起八糟的错误太烦人了,不管怎么样,现在面临了最大的困难吧,图像处理算法.算法确实不好弄啊,虽然以前整过,但都不是针对图像的. 现在的图像 ...
- [RxJS] Basic DOM Rendering with Subscribe
While frameworks like Angular 2 and CycleJS provides great ways to update the DOM and handle subscri ...
- 【Linux】linux经常使用基本命令
Linux中很多经常使用命令是必须掌握的,这里将我学linux入门时学的一些经常使用的基本命令分享给大家一下,希望能够帮助你们. 这个是我将鸟哥书上的进行了一下整理的,希望不要涉及到版权问题. 1.显 ...
- 正确的安装qwtplot3D开发库
1.从网上下载qwtplot3D的最新版本:http://qwtplot3d.sourceforge.net/ 2.解压qwtplot3d-0.2.7.zip到C盘根目录下(注意:路径中不能带有中文汉 ...
- shell读取文件参数
环境 csh 说明 通常我们需要使用使用shell脚本处理一些事务,每次调用shell都需要添加参数. 如果重复调用多次这个shell脚本,我们可以将参数存入指定文件,循环得到参数. shell脚本( ...
- 主运行循环main run loop的一些理解
应用主运行循环负责处理所有用户相关的事件.UIApplication对象在应用启动时安装主运行循环并且使用此循环去处理事件和处理基于视图的界面更新.正如名字所表明的,该主运行循环是在应用的主线程app ...
- C#构造函数的 "继承" 问题
首先说明下 之所以用 双引号 是因为构造函数是没有继承的 派生类默认会调用基类的无参数构造函数 比如: public class A { public A() { Co ...
- RDLC报表上下标实现
例:m的6次方 ="M"&ChrW(8310) Character Name Character Num Entity Hex Entity Superscript Cha ...
- 不指定order by时Sql的排序
在sql中不指定Order by,排序是按照主键吗?答案是不一定.举个例子: 查询AttendanceEmpRank表,主键是AttendanceEmployeeRankId,而且是聚集索引 ...
- Windows命令行(DOS命令)教程-7 (转载)http://arch.pconline.com.cn//pcedu/rookie/basic/10111/15325_6.html
11. deltree [功能] 删除目录树 [格式] [C:][path]DELTREE [C1:][path1] [[C2:][path2] […]] [说明] 这个命令将整个指定目录树全部消灭, ...