社区
JavaScript
帖子详情
关于XPATH的不等于
rotApple
2008-04-08 10:39:03
比如:
"/history/item[@replace='true'] | /history/item[@replace='1']"
可以选取replace=true或replace=1的所有item
现在的问题就是我要选取所有replace不是true和1,或者没有replace节的对象, 该怎么写呢?
谢谢.
...全文
486
9
打赏
收藏
关于XPATH的不等于
比如: "/history/item[@replace='true'] | /history/item[@replace='1']" 可以选取replace=true或replace=1的所有item 现在的问题就是我要选取所有replace不是true和1,或者没有replace节的对象, 该怎么写呢? 谢谢.
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
9 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
rotApple
2008-04-14
打赏
举报
回复
还是没人?
rotApple
2008-04-09
打赏
举报
回复
顶
xingqiliudehuanghun
2008-04-08
打赏
举报
回复
mark
rotApple
2008-04-08
打赏
举报
回复
谢谢.
刚才大概查了一下.
写成这样可以: /history/item[not(@replace)]
现在就是不知道怎么把这三种合到一起如果写成/history/item[not(@replace)] | /history/item[@replace!='true'] | /history/item[@replace!='1']肯定不行
后面的两个需要and但写成/history/item[not(@replace)] | /history/item[@replace!='true'] and /history/item[@replace!='1']就一个也不出来了.
如果把and换成|就全部出来了,没有过滤.
另外想知道有转换数据类型的函数吗? 比如/history/item[boolean(@replace)!=true].
hookee
2008-04-08
打赏
举报
回复
| 是Union
and 是与
or 是或
rotApple
2008-04-08
打赏
举报
回复
还有, |的反义词可以用&吗? 还是&&还是什么的?
rotApple
2008-04-08
打赏
举报
回复
楼上的, 受教了
不过用了not /history/item[name(@replace)!='replace' 或者把not删掉, 都滤不出来. 一个都没选到.
可以帮我解释一下not和这个name吗? 谢谢.
hookee
2008-04-08
打赏
举报
回复
"/history/item[@replace!='true'] ¦ not /history/item[name(@replace)!='replace']"
rotApple
2008-04-08
打赏
举报
回复
按理说写成这样是可以的, 因为我查了很多资料都是用的boolean(@replace)=true
"/history/item[boolean(@replace)=TRUE]"
"/history/item[not(@replace)] | /history/item[boolean(@replace)=FALSE]"
但只要用了boolean(@属性节)就不成功了. 不知道为什么转换不成布尔值, 但是string(@属性节)可以返回string, 真是奇怪了.
找到不包含@replace属性的节用/history/item[not(@replace)]已经可以了.
xpath
表达式测试小工具
xpath
表达式测试小工具,很实用。推荐。上次不知道为什么被删掉了。重发。
XPath
解析工具
C#写的
XPath
解析工具
XML必知必会:Java、C#、Python多种语言解析XML文档
XML是所有软件开发人员都应该熟悉的技术,如果你还不熟悉就选择这门课程。 第1章 XML概述 什么是XML、XML和HTML之间的区别 第2章 XML编辑工具 跨平台文本编辑工具、Windows平台文本编辑工具、Visual Studio Code工具...
XPath
-Helper 爬虫 网络
提取,编辑和轻松评估
XPath
查询。
XPath
的助手很容易提取,编辑,并在任何网页评估
XPath
查询。 重要提示:安装此扩展后,必须重新加载任何现有的选项卡或重新启动Chrome浏览器扩展工作。 说明: 1.打开一个新的标签,并导航到任何网页。 2.按Ctrl-Shift键-X(或OS X命令移-X),或单击工具栏上的
XPath
的助手按钮,以打开
XPath
助手控制台。 3.按住Shift键将鼠标悬停在页面上的元素。查询框将不断更新,以显示鼠标指针下方的元件
XPath
查询,结果框将显示当前查询的结果。 4.如果需要,请在控制台直接编辑
XPath
查询。结果框会立即反映更改。 5.重复步骤(2)关闭控制台。 如果控制台在你的方式获得,按住Shift键,然后将鼠标移动到它; 它会移动到页面的相对侧。 一个忠告:当渲染HTML表格,浏览器插入人工
标记到DOM,这将在随后通过该扩展提取查询显示出来。 Extract, edit, and evaluate
XPath
queries with ease.
XPath
Helper makes it easy to extract, edit, and evaluate
XPath
queries on any webpage. IMPORTANT: After installing this extension, you must reload any existing tabs or restart Chrome for the extension to work. Instructions: 1. Open a new tab and navigate to any webpage. 2. Hit Ctrl-Shift-X (or Command-Shift-X on OS X), or click the
XPath
Helper button in the toolbar, to open the
XPath
Helper console. 3. Hold down Shift as you mouse over elements on the page. The query box will continuously update to show the
XPath
query for the element below the mouse pointer, and the results box will show the results for the current query. 4. If desired, edit the
XPath
query directly in the console. The results box will immediately reflect your changes. 5. Repeat step (2) to close the console. If the console gets in your way, hold down Shift and then move your mouse over it; it will move to the opposite side of the page. One word of caution: When rendering HTML tables, Chrome inserts artificial
tags into the DOM, which will consequently show up in queries extracted by this extension.
xpath
不等于
、不包含的写法
简介:写自动化用例时经常会用到
xpath
来定位元素,这里总结一下
xpath
语法中
不等于
、不包含的写法 问题 如下图:该页面有两个页签,我们需要在第二个页签进行操作:在输入框输入后点击确定按钮。 第一次写的
xpath
是这样的 //button[./span[text()='确定']] 运行时报错Element is not clickable at point,出现这种错误通常因为是这个xpat...
JavaScript
87,910
社区成员
224,616
社区内容
发帖
与我相关
我的任务
JavaScript
Web 开发 JavaScript
复制链接
扫一扫
分享
社区描述
Web 开发 JavaScript
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章