CSSSelector

Example

Description

element.element

div.dropdown

Select all  <div> elements whose class=“dropdown”

element#element

div#new-input

Select all <div> elements whose id =“new-input”

element element

div p

Select all <p> elements who are under <div> element

element>element

div>p

Select all <p> elements whose father is <div> element

[attribute]

div[rowid]

Select all <div> elements who has attribute rowid

[attribute=value]

input[value='OK']

Select all <input> elements whose attribute value is ‘OK’

[attribute*=value]

a[src*=‘abc’]

Select all <a> elements whose attribute src contains  ‘abc’

:nth-child(n)

p:nth-child(2)

Select all <p> elements who is the second child of its  father

eg 1:  div.rtq-grid-row[rowid]  div.rtq-grid-cell:nth-child(5)  a

eg 2: div#fileUpDiv  input[value='OK']

[Selenium] The most commonly used CSSSelector的更多相关文章

  1. selenium元素定位Xpath,Contains,CssSelector

    最近有人问到定位问题,基本上我用以下三个方法可解决,但不同的项目使用方法不一样.以下为自己所用的简单记录说明 1.Xpath 经常使用且最能解决问题的定位 driver.findElement(By. ...

  2. selenium定位方法(java实例)(二)

    从下图中可以看到selenium有三类定位元素的方法,一种是直接通过属性.标签以及链接来定位,一种是XPath方式,最后一种是CSS方式. 下表列举了元素定位的例子 selenium之页面元素定位方法 ...

  3. Selenium-IDE,在网页上模拟人的操作

    想偷懒,不想做很机械重复的网页操作,就百度了一下看看有什么方法,能把自己从重复性的网页操作中解放出来,于是,百度到了selenium ide,折腾许久,用最新版火狐添加了自带selenium ide组 ...

  4. Selenium-IDE在火狐上的扩展

    昨天突然想学学 Selenium,就上网查了一些介绍,发现一些教程基本都是比较老版本的了,使用起来略有不便,所以今天试着写一些最新版本的.请参考Selenium官网.文章以下内容都是在 Mac 机器上 ...

  5. 【Selenium专题】元素定位之CssSelector

    CssSelector是我最喜欢的元素定位方法,Selenium官网的Document里极力推荐使用CSS locator,而不是XPath来定位元素,原因是CSS locator比XPath loc ...

  6. CssSelector之selenium元素定位

    CssSelector是我最喜欢的元素定位方法,Selenium官网的Document里极力推荐使用CSS locator,而不是XPath来定位元素,原因是CSS locator比XPath loc ...

  7. cssSelector定位写法大全(适用于selenium、robotframework)

    1.定位weibo登录框 输入框的元素信息如下 css的写法(可以看到name属性的属性值是“username”,class属性的值“W_input" driver.findElement( ...

  8. Selenium 中 cssSelector定位

    一.为什么使用cssSelector定位元素? 目前针对一些常规定位方式有:By.id.By.name.By.LinkTest(针对<a>标签).By.ClassName 针对不太好定位的 ...

  9. [Selenium] The commonly used validation method

    Assert.assertTrue(tmpEl.getAttribute("class").contains("selected"),"The fol ...

随机推荐

  1. golang 进程、线程、协程 简介

    https://www.cnblogs.com/shenguanpu/archive/2013/05/05/3060616.html https://studygolang.com/articles/ ...

  2. Chrome查看DNS状态提示:DNS pre-resolution and TCP pre-connection is disabled.

    chrome://dns 别试了,在这个功能在旧版可以通过关闭预读可以实现,但是新版的不行. 但是可以通过这种方式替代: chrome://net-internals/#dns 这个方式更直观,可以看 ...

  3. C# 把控件内容导出图片

    Bitmap newbitmap = new Bitmap(panelW.Width, panelW.Height);            panelW.DrawToBitmap(newbitmap ...

  4. 【spring data jpa】报错如下:Caused by: javax.persistence.EntityNotFoundException: Unable to find com.rollong.chinatower.server.persistence.entity.staff.Department with id 0

    报错如下: org.springframework.orm.jpa.JpaObjectRetrievalFailureException: Unable to find com.rollong.chi ...

  5. Go -- 并发编程的两种限速方法

    引子 golang提供了goroutine快速实现并发编程,在实际环境中,如果goroutine中的代码要消耗大量资源时(CPU.内存.带宽等),我们就需要对程序限速,以防止goroutine将资源耗 ...

  6. ivy在eclipse中的重新加载

    ivy在eclipse中的重新加载 如果由于网速的原因,导致了ivy没有正常的加载,可以进行ivy的重新加载: 1,右键点击项目,选择属性->Java Build Path->Librat ...

  7. 【leetcode】 26. Remove Duplicates from Sorted Array

    @requires_authorization @author johnsondu @create_time 2015.7.22 18:58 @url [remove dublicates from ...

  8. 嵌入式学习笔记(综合提高篇 第二章) -- FreeRTOS的移植和应用

    1.1    资料准备和分析 上章节通过实现双机通讯,了解如何设计和实现自定义协议,不过对于嵌入式系统来说,当然不仅仅包含协议,还有其它很多需要深入学习了解的知识,下面将列出我在工作和学习上遇到的嵌入 ...

  9. C#模拟登录Facebook 实现发送消息、评论帖子

    由于目前电脑网页版FB实现模拟登录比较困难,本次选择了FB的手机版页面进行登录 MVC: private static string UserName = "用户名"; priva ...

  10. 使用string实现一个用于储存那些太大而无法使用 long long 的数

    类的定义: class stringInt { public: stringInt(); stringInt(string num); stringInt(int num); stringInt op ...