Evaluate and validate XPath/CSS selectors in Chrome Developer Tools

Method 1 : From Elements panel

Use the search function inside Elements panel to evaluate XPath/CSS selectors and highlight matching nodes in the DOM.

1.Press F12 to open up Chrome DevTools.
2.Elements panel should be opened by default.
3.Press Ctrl + F to enable DOM searching in the panel.
4.Type in XPath or CSS selectors to evaluate.
5.If there are matched elements, they will be highlighted in DOM. However, if there are matching strings inside DOM, they will be considered as valid results as well. For example, CSS selector header should match everything (inline CSS, scripts etc.) that contains the word header, instead of match only elements.

Method 2 : From Console panel

Execute tokens $x("some_xpath") or $$("css-selectors") in Console panel, which will both evaluate and validate.

1.Press F12 to open up Chrome DevTools.
2.Switch to Console panel.
3.Type in XPath like $x(".//header") to evaluate and validate.
4.Type in CSS selectors like $$("header") to evaluate and validate.
5.Check results returned from console execution
If elements are matched, they will be returned in a list. Otherwise an empty list [ ] is shown.
If the XPath or CSS selector is invalid, an exception will be shown in red text.

[Selenium] 在Chrome的开发者工具中验证检查XPath/CSS selectors的更多相关文章

  1. chrome谷歌开发者工具(hover时候的css样式怎么在浏览器调试)

    很多小伙伴在开发的时候,大多是在用谷歌开发者工具调试代码(快捷键F12 或 Ctrl-Shift-i). 可能会经常遇到需要调试hover样式的时候,一般都是直接改代码,然后在页面上刷新查看效果. 其 ...

  2. 【译】在 Chrome 开发者工具中调试 node.js

    原文链接 : Debugging Node.js in Chrome DevTools 原文作者 : MATT DESLAURIERS 译文出自 : 掘金翻译计划 译文链接 : https://git ...

  3. 在chrome开发者工具中观察函数调用栈、作用域链与闭包

    在chrome开发者工具中观察函数调用栈.作用域链与闭包 在chrome的开发者工具中,通过断点调试,我们能够非常方便的一步一步的观察JavaScript的执行过程,直观感知函数调用栈,作用域链,变量 ...

  4. 在chrome开发者工具中观察函数调用栈、作用域链、闭包

    在chrome的开发者工具中,通过断点调试,我们能够非常方便的一步一步的观察JavaScript的执行过程,直观感知函数调用栈,作用域链,变量对象,闭包,this等关键信息的变化.因此,断点调试对于快 ...

  5. 在 Chrome 开发者工具中调试 node.js

    命令行工具 devtool ,它可以在 Chrome 的开发者工具中运行 Node.js 程序. 下面的记录显示了在一个 HTTP 服务器中设置断点的情况. 该工具基于 Electron 将 Node ...

  6. 前端基础进阶(六):在chrome开发者工具中观察函数调用栈、作用域链与闭包

    在前端开发中,有一个非常重要的技能,叫做断点调试. 在chrome的开发者工具中,通过断点调试,我们能够非常方便的一步一步的观察JavaScript的执行过程,直观感知函数调用栈,作用域链,变量对象, ...

  7. 使用chrome开发者工具中的network面板测量网站网络性能

    前面的话 Chrome 开发者工具是一套内置于Google Chrome中的Web开发和调试工具,可用来对网站进行迭代.调试和分析.使用 Network 面板测量网站网络性能.本文将详细介绍chrom ...

  8. chrome浏览器开发者工具F12中某网站的sources下的源码如何批量保存?

    目录 chrome浏览器 开发者工具F12中某网站的sources下的源码如何批量保存 1. 常用保存Sources源码的两种方法 1.1单个文件 1.2 单个页面 2. 问题 3.解决方案 chro ...

  9. 谷歌Chrome浏览器开发者工具的基础功能

    上一篇我们学习了谷歌Chrome浏览器开发者工具的基础功能,下面介绍的是Chrome开发工具中最有用的面板Sources.Sources面板几乎是最常用到的Chrome功能面板,也是解决一般问题的主要 ...

随机推荐

  1. DataSource - 常用数据库连接池 (DBCP、c3p0、Druid) 配置说明

    1. 引言 1.1 定义 数据库连接是一种关键的有限的昂贵的资源,这一点在多用户的网页应用程序中体现得尤为突出.对数据库连接的管理能显著影响到整个应用程序的伸缩性和健壮性,影响到程序的性能指标.数据库 ...

  2. 阿里轻量应用服务器 Tomcat 注意的地方 Unsupported major.minor version 52.0(unable to load class

    本地编译工程,提交到远程服务其的tomcat上报这个错 Unsupported major.minor version 52.0(unable to load class com.cl.busines ...

  3. PHP 获取数组是几维数组

    // 判断数组是几维数组$data = array(); // 是你要判断的数组$al = array(0);function aL($data,&$al,$level=0){ if(is_a ...

  4. 【RestTemplete】使用RestTemplete传Json或者 {} 报错--解决

    https://jira.spring.io/browse/SPR-9220?focusedCommentId=76760&page=com.atlassian.jira.plugin.sys ...

  5. Avalon Master 外设

  6. Learn the Basics - RN2

    使用Image 1. 引用 import { Image } from 'react-native'; 2. 使用 format: <Image source={{}} style{{}} /& ...

  7. File mapping

    文件映射的三个功能: 1.File mapping allows the process to use both random input and output (I/O) and sequentia ...

  8. sysctl-p报错:error: "net.bridge.bridge-nf-call-ip6ta

    1.刚配置完sysctl,加载时报错:[root@itpux1 yum.repos.d]# sysctl -pnet.ipv4.ip_forward = 0net.ipv4.conf.default. ...

  9. 面试回顾——session相关

    原地址:https://blog.csdn.net/quiet_girl/article/details/50580095 Session结束生命周期的几种情况: (1)客户端关闭浏览器(只针对ses ...

  10. 工程C++基础

    大家好,我是老A.今天我们要学习的是工程C++,这是一个不可描述的东西.我主要讲的是template. template的用处是装逼,所以很重要. C++配备了函数模板和类模板.函数模板就是我们平时的 ...