xpath

火狐浏览器+Firebug+FirePath测试Xpath

梦想与她 提交于 2020-03-24 08:14:08
前言 抓取网页数据时使用HtmlAgilityPack分析,需要通过xpath定位页面元素。如果有个xpath的生成和验证工具就事半功倍了,火狐浏览器插件FirePath配合Firebug就能完美实现。 FirePath介绍如下: FirePath is a Firebug extension that adds a development tool to edit, inspect and generate XPath 1.0 expressions, CSS 3 selectors and JQuery selectors.With FirePath you can: * Edit XPath expressions, CSS3 selectors and JQuery selectors (Sizzle selector engine) with auto completion for XPath (using TAB or up and down arrows). * Evaluate the expression/selector on any HTML or XML documents. * Display the result of evaluations in a Firebug-like DOM tree. * Highlight the results

Python ElementTree find() using namespaces

时光怂恿深爱的人放手 提交于 2020-03-24 00:38:02
问题 I am attempting to use Python’s ElementTree to parse and modify an xml file. The confusion comes with the XML Namespace. I can use the findall and finditer to get all of the servers names. However, I can't get the xpath query to work to find a specific server. instead the find just brings back the parent element. What I need to do is find the correct server by the “name” or “machine” element and modify the “arguments”. <? xml version=’1.0’ encoding=’UTF-8’?> <domain xmlns=”http://xmlns.oracle

Robot Framework ---Selenium API

旧街凉风 提交于 2020-03-23 20:50:30
一、浏览器驱动 通过不同的浏览器执行脚本。 Open Browser Htpp://www.xxx.com chrome 浏览器对应的关键字: firefox FireFox ff internetexplorer Internet Explorer ie googlechrome Google Chrome gc chrome opera Opera phantomjs PhantomJS htmlunit HTMLUnit htmlunitwithjs HTMLUnit with Javascipt support android Android iphone Iphone safari Safari 备注: 要想通过不同的浏览打开URL地址,一定要安装浏览器相对应的驱动。如chrome 的驱动: chromedriver.exe 等。 浏览器默认为空时启动FireFox。 二、关闭浏览器 关闭浏览器 Close Browser 关闭当前的浏览器。 关闭所有浏览器 Close All Browsers 关闭所有打开的浏览器和浏览器缓存重置。 三、浏览器最大化 Maximize Browser Window 使当前打开的浏览器全屏。 四、设置浏览器宽、高 Get Window Size 800 600 以像素为单位,第一个参数800表示宽度,第二个参数600表示高度。 五

【复习】selenium中用Xpath定位

佐手、 提交于 2020-03-23 18:23:34
一、基础属性定位 id/class/name 百度一下按钮://input[@id="su"]* text()定位 更多产品链接定位://*[text()="更多产品"] 二、索引过滤 当定位出现多个兄弟结果时,可以索引过滤,坐标从1开始,最后用last() 新闻链接://a[@class="mnav"][1] 学术链接 //a[@class="mnav"][last()] 三、逻辑运算定位 新闻链接://a[@class="mnav" and text()="新闻"] 四、轴定位(轴名称::节点名称) ancestor:祖先节点包括父节点 parent:父节点 preceding-sibling: 选取当前节点之前的所有同级节点(html页面位置) preceding:当前节点之前的所有节点(html页面位置) following-sibling:当前节点之后的所有兄弟节点(html页面位置) following:当前元素节点之后的所有节点(html页面位置) 例:查找地图的兄弟节点新闻: //a[@name="tjtrmap"]/parent::div/[text()="新闻"] 来源: 51CTO 作者: wx57a1620925627 链接: https://blog.51cto.com/11926720/2481077

Extract, create and append using xpath and telegram instant view

瘦欲@ 提交于 2020-03-23 12:02:21
问题 <iframe src="https://expmle.com/subdirectory/sample_title" /> How can I create and append below <a> tag from above code using XPath and Telegram Instant view functions? <a href="https://expmle.com/subdirectory/sample_title">sample_title</a> I want to extract whole src and last part of that and use of them to create <a> tag. Any suggestions would be very appreciated :) 回答1: This should work correctly. <a>: //iframe # Find iframe and convert it to <a> @set_attr(href, ./@src) # Set href

SQL Server XML querying: Query multiple child elements with same name

£可爱£侵袭症+ 提交于 2020-03-23 09:51:43
问题 In a previous question I wanted to know how I can use SQL to JOIN different XML elements based on an identifier. I was provided with several nice solutions as you can see here. Now I am in the process of adapting this solution to my actual data. Unfortunately I stumbled upon a new obstacle that was not present in the minimum viable example I provided in the linked question. In my actual data I also have several child elements of the same name. See the element <subElement> in the following

SQL Server XML querying: Query multiple child elements with same name

纵然是瞬间 提交于 2020-03-23 09:51:13
问题 In a previous question I wanted to know how I can use SQL to JOIN different XML elements based on an identifier. I was provided with several nice solutions as you can see here. Now I am in the process of adapting this solution to my actual data. Unfortunately I stumbled upon a new obstacle that was not present in the minimum viable example I provided in the linked question. In my actual data I also have several child elements of the same name. See the element <subElement> in the following

XPath: select node that contains normalized text, excluding ancestor nodes

心不动则不痛 提交于 2020-03-23 08:01:58
问题 I'm looking for a performant, generic query to select "The quick brown fox jumped over the lazy dog." similar to how a simple CMD+C would copy the text. It seems that I need to use the textContent , but my XPath is also selecting the ancestors (up to body), rather than just the first (few) ancestors. How can I limit the scope? example node.textContent " The quick brown fox jumped over the lazy dog. " Run Code Snippet → Full Page → Follow instruction <div id='dont-select-this' style='text

Get table row text python selenium

时间秒杀一切 提交于 2020-03-23 07:35:40
问题 This is the html <table id="dataLstSubCat" cellspacing="0" style="border-collapse:collapse;"> <tbody><tr> <td style="font-weight:normal;font-style:normal;text-decoration:none;white-space:nowrap;"> <a onclick="ShowHideProduct();" id="dataLstSubCat_LnkBtnSubCat_0" href="javascript:__doPostBack('dataLstSubCat$ctl00$LnkBtnSubCat','')">Primers</a> </td><td style="font-weight:normal;font-style:normal;text-decoration:none;white-space:nowrap;"> <a onclick="ShowHideProduct();" id="dataLstSubCat

利用updatexml()报错注入mysql

徘徊边缘 提交于 2020-03-22 20:16:57
基本介绍一下updatexml() updatexml(XML_document, XPath_string, new_value) XML_document是文档对象的名称 XPath_string是XPath格式的字符串( 如果XPath_string不是XPath格式,则会报错并显示出XPath_string的值 ) new_value替换查找到的数据 XPath语法介绍:https://blog.csdn.net/dearbaba_8520/article/details/81557827 再看看常用的语句 updatexml(1,concat(1, payload ),1)。 concat()函数用于将多个字符串连接成一个字符串,目的是让拼接后的字符串不符合XPath格式使其报错,显示出要查的对象。 最终的目的是使其报错,至于拼接的值多种多样,并不局限于1。 以sqli-labs为例: 可以看到,把payload位置改为database()后报错返回了当前数据库的名称 之后按照注入流程爆出表名,字段名即可 来源: https://www.cnblogs.com/remon535/p/12547932.html