Xpath vs queryselector.

Xpath vs queryselector Description. Use Relative XPath when the exact location of the element is less critical, or when you need to target elements based on their attributes, relationships, or content rather than their exact position in the document hierarchy. Jun 20, 2023 · This will produce a rather long XPath expression, why an understanding of the XPath syntax is preferable here. 组合定位 playwright 可以通过 CSS selector , XPath selector , HTML 属性(… Nov 2, 2011 · xpath vs DOM API. That way you can see the minor configuration difference and see which tests effectively work in action. filter(function (el) { return el. evaluate() document. click(); Yet the element wasn't selected in both cases and no click happened. querySelector([data-test-id=“name”]) as same as Keywords I trying but it not work WebUI. see the reference code below: Apr 9, 2025 · XPath offers more flexibility and advanced features compared to CSS selectors. . evaluate() 方法评估 XPATH 查询/表达式。因此,您可以在那里传递 XPATH 表达式,遍历 HTML 文档并找到所需的元素。 在 XPATH 中,您可以通过如下文本节点选择一个元素,获取具有以下文本节点的 div 。 //div[text()="Hello World"] Mar 30, 2021 · Playwright支持提供简写语法,根据内容自动判断选择器: 1. 该篇文档描述了如何在 JavaScript 中调用 XPath 接口。使用 XPath 的主要接口是 document 对象的 evaluate 函数。 Feb 11, 2025 · Note, in the above example, a more verbose xpath is preferred over common shortcuts such as //h2. In this XPath vs. log or inside your IDE or directly in VS Code with the VS Code Extension. Selectors are strings, and they are the foundation of Playwright’s Aug 8, 2024 · With XPath, you’ll see less maintenance on the part of the QA tester. queryAll(root, selector) Mar 25, 2018 · Propriamente dito querySelector() ou querySelectorAll() são seletores de CSS já XPath é próprio para DOM (seletor de nós) eu mesmo já não uso mais e nunca fiz questão de testar mas depois de seu comentário fiz uma breve pesquisa e encontrei este teste em jsperf. css 选择器 2. Oct 14, 2024 · XPath Selectors: While identifying elements which do not have unique attributes or they are nested elements, for these conditions XPath is the most appropriate solution. Therefore, this expression was able to Jun 20, 2022 · XPath What it is XPath stands for XML Path. The Document querySelector() Method. Click the first Web element that matches an XPath Mar 29, 2023 · Hi ramya, I have tried like this: Use Shadow Path generator chrome extension and get the string value and by using js executor, click on the shadow dom and enter into it. querySelector(selector); Code language: JavaScript (javascript) document. The Element querySelectorAll() Method. To use Puppeteer with XPath, you can use the `querySelector()` method. querySelector() //for single node with css like path or selector document. What CSS selectors are, how they work, and their pros and cons. But if yon't know which element selection language is best for you, read our comparison article on XPath vs CSS selector . So, I ask them add an attribute into their code as same as data-test-id="name" for I finding element point. querySelector样式选择器进行html解析(三):实现样式选择器-----_document. Common behavior //* selects all elements within a document. All other answers involve creating some wrapper function around querySelector, not directly using a single call to querySelector. querySelector() only accepts a valid css selector as argument, so taken literally, mine is the only answer that allows you to find an element by innerText using querySelector. This is because the evaluation of the query does not waste time visiting unnecessary nodes. After going through this review, you can decide for yourself the best selector for web scraping. Apr 20, 2019 · There is a very good plugin that can be used with selenium project shadow-automation-selenium. 0+ behavior This XPath, //*[contains(text(),'ABC')] behaves differently with XPath 1. XPath can walk up the DOM (e. The "Hello World!" can be in its id, its value, its name, its title, its onclick etc, anywhere. In this article, we will try to cover complete functionality and the implementation of playwright selectors and locators. This article provides some XPath code snippets — examples of how to implement a few utility functions. Compare the speed of xpath evaluate to querySelector. document. Nov 8, 2023 · Browser automation is a powerful skill set, but it comes with unique challenges—including working with selectors and locators. call(document. querySelector(xpath); console. Ask Question Asked 13 years, 2 months ago. When implementing web scraping solutions, choosing the right selector method — CSS Selectors or XPath — can significantly impact your project’s efficiency, maintainability, and success. While we typically use CSS to target input elements, XPath’s targeting method is similar but allows for some additional features. * @param {RegExp} regEx regular expression to match against tagName * @returns {Array} elements in the DOM that match */ function getAllTagMatches(regEx) { return Array. I will just use what community has been found. Jul 12, 2024 · Reading the value of outerHTML returns a string containing an HTML serialization of the element and its descendants. evaluate() (DOM Level 3 XPath) is supported in Firefox, Chrome, Safari and Opera - the only major browser missing is MSIE. The Document querySelectorAll() Method. Nov 26, 2024 · xpath evaluate vs. Step-by-step instructions: Jul 26, 2024 · querySelector() Returns the first matching Element node within the node's subtree. querySelector样式选择器进行html解析(四):将选择结果封装进行输出. Before we dig into Xpath let's have a quick overview of HTML itself and how it enables xpath language to find anything with the right instructions. querySelector() method to fetch the element. querySelector进行html解析(一):将html转成xml使用xpath实现document. from child to parent), whereas cssSelector can only traverse down the DOM (e. Time to dive in! XPath: Complete Analysis Apr 10, 2025 · The Document method querySelector() returns the first Element within the document that matches the specified CSS selector, or group of CSS selectors. /** * Find all the elements with a tagName that matches. In XPath 2. from parent to child) May 29, 2023 · To summarize XPath vs CSS selectors - both are great tools for parsing HTML though CSS selectors are briefer and easier to use while XPath is more powerful but more verbose and complex. 文章浏览阅读4. click(); let myEl = document. Advantages of XPath Allows navigation up the DOM when looking for elements; More flexible than CSS Selectors Puppeteer allows interacting with elements on the page through mouse, touch While those in favor of XPath tout it's ability to transverse the page (while cssSelector cannot). Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more. All of the queries exported by DOM Testing Library accept a container as the first argument. XPath expressions look very similar to the ones you would see when working with a traditional computer file Oct 10, 2023 · Playwright is a powerful test automation framework, allowing users to control web applications and conduct End to End test automation. Playwright supports CSS and XPath selectors, and auto-detects them if you omit css= or xpath= prefix. By why use XPath when methods like querySelector and querySelectorAll work great? It’s all because of the structure of an HTML document. Here's a breakdown of both methods: Performance: querySelectorAll() is generally well-optimized in modern browsers for CSS selector queries. It uses XML document and queries it to identify elements within it. using console. querySelector(): Again each browser will result a slightly difference. The Document getElementsByTagName() Method. [] filters those elements according to the predicate expressed therein. 使用xpath实现document. innerTEXT;alert(text);但这当然行不通。 Jul 23, 2014 · xpath (query: str, namespaces: Mapping [str, str] | None = None, ** kwargs: Any) → SelectorList [_SelectorType] [source] ¶ Find nodes matching the xpath query and return the result as a SelectorList instance with all elements flattened. 0+). innerText. Nevertheless, Aug 31, 2022 · document. (with the path //*[@id="search-button"] for example, it will just click on the Search button on this page. It was tough for me to figure that out so I figured I would put this up in case anyone else had this problem. Let’s consider the method parameters: expression is a string representation of the XPath to be Mar 5, 2024 · # Get Element by XPath using JavaScript - Examples. 3. Creating in XPath is more flexible than in CSS Selector. This is useful when an expression will be reused in an application, because it is just compiled once and all namespace prefixes which occur within the expression are preresolved. The Evaluate(expression, contextNode, resolver, type, result) method accepts an XPath expression and other given parameters and returns a result of the specified type. querySelector('div. The problem here is that both syntax can have arbitrary strings in it: xpath: //*[contains(text(),"string")] This comparative review highlights the main differences between XPath vs. querySelector (from an element) querySelector vs querySelectorAll vs getElementsByClassName vs querySelector (ID) vs getElementsByID (2) aaaaafffffffffffffggg; querySelector vs getElementsByTagName Apr 6, 2023 · 使用xpath实现document. This Apr 25, 2023 · let p_tag = document. 9k次。使用xpath实现document. xpathを紹介します。 QuerySelector Methods: The Element querySelector() Method. Playwright supports CSS and XPath selectors and auto-detects them if you omit css= or xpath= prefix. This post will explain the basics of XPath in easy-to-understand terms, giving you the tools to start scraping effectively. querySelector样式选择器进行html解析(一):将html转成xml 使用xpath实现document. In fact it doesn't come from casperjs at all, and is supported by the browser, which is why it accepts CSS3 selectors, and not XPath. pp = page. querySelector进行html解析(二):扩展一下xpath以便支持正则-----继续我们的工作,在进行下一步之前,先考虑一下,为_document xpath Feb 21, 2019 · document. XPath also offers a rich set of built-in functions and operators, enabling advanced selection and data processing tasks. querySelector样式选择器进行html解析(一):将html转成xml使用xpath实现document. Xpath can transform results before returning them. Jun 1, 2024 · QuerySelector() to get the first HTML node that matches the CSS selector passed as an argument. ここまで CSS セレクタと比較しながら XPath をみてきましたが、XPath は CSS よりもはるかにパワフルにノードを指し示すことができます。CSS セレクタの完全上位互換と言ってもいいと思います 2 。 チートシート May 15, 2012 · document. selector选择器 1. The following illustrates the syntax of the querySelector() method: let element = parentNode. ), keep in mind that such references quite often contain relative file paths in May 7, 2016 · 怎样才能找到带有特定文本的DIV?例如: SomeText, text continues. XPath は CSS セレクタよりもはるかにパワフル. As HAP natively supports XPath expressions, you should prefer them over CSS selectors. The syntax is: var xpathResult = document. Both querySelector() and querySelectorAll() throw a SYNTAX_ERR exception if the selector(s) is invalid. Jun 3, 2021 · document. Conclusion. If you must use CSS or XPath locators, you can use page. See the docs for each query type to see available options, e. querySelectorAll combined with ES6 spread to get array e. In this XPath vs CSS Selector guide, you will learn: What XPath expressions are, how they work, and their advantages and drawbacks. For this we only need to apply the following configuration: Feb 5, 2014 · 具体的サンプルの前に。 ブラウザでXpathを手軽に実行できる、document. 0, you can apply text pattern matching with matches(). First, let’s discuss the XPath selectors for web scraping. g [document. XPath expressions can contain logical operators like and, or, as well as arithmetic operations and string functions. Playwright locator by class name and text Learn how to use Playwright to locate elements by class name and text efficiently. 0 vs XPath 2. Parece que XPath é mais rápido que querySelectorAll() – Dec 18, 2023 · They leverage various strategies such as CSS, XPath, textual content, pseudo-selectors, and even custom properties you define. Apr 3, 2023 · To locate this element using the class attribute, I have used the starts-with() method in this XPath vs CSS Selectors blog, and the XPath expression looks like this: As you can see in the above example of this XPath vs CSS Selectors blog, the class attribute value starts with the class name “mt-20”. Aug 22, 2024 · Xpath can traverse HTML trees in every direction and is location-aware. querySelector('div[SomeText*]'). evaluate() method to get an element by XPath. Fine-grained attribute-based selection and data extraction. What is Locator? Locators are used to select the specific element in the DOM tree. The next step is to present the user with the list of available books. query is a string containing the XPATH query to apply. getElementsByClassName (from document) vs parent. XPath, which stands for XML path language, is a query language that is used to select nodes from an XML document. querySelector样式选择器进行html解析(二):扩展一下xpath以便支持正则 使用xpath实现document. In this example, we are using the document. tagName. While CSS selectors don't allow it. For instance, XPath selectors often begin with //, indicating a search anywhere in the document. Here is a generic macro which clicks on the first item (in Safari or Chrome) which matches an XPath expression in a KM variable. Locate by CSS or XPath. screen . 2k次。使用xpath实现document. We can use the Prompt widget from Spectre. See this post for details. getAttribute Jan 9, 2018 · Historically, XPath was also used to select elements by text in Puppeteer, but this is no longer necessary since new syntax has been introduced specifically to select by text. evaluate( xpathExpression, contextNode, namespaceResolver, resultType, result ); Learn how to use Playwright's querySelector and XPath for efficient web automation and testing. evaluate 関数ですが、理屈が分からないと使いにくいので、document. XPath provides axes, which allow for bidirectional traversal of the DOM tree and more complex element selection. Mar 20, 2017 · 本文介绍querySelector和querySelectorAll方法的应用,这两种方法简化了元素的选择过程,并提供了类似于jQuery的查询方式。 通过实例展示了如何使用这些方法来选择单一元素和元素集合。 Mar 19, 2024 · queryOptions . 以 // 或 / 或者 . I can not find element by id or class because FE dev using a framework and it will be generation random id, class. CSS selector being know that faster than xpath . Commented Nov 2, 2011 at 11:42. The main interface to using XPath is the evaluate function of the document object. text 文本选择器 4. xpath 语法定位 3. When searching for web page elements by their attributes that contain references to files (for instance, the href attribute in A elements, the src attribute in IMG elements, etc. Use the document. You know Dec 11, 2018 · XPath, the XML path language, is a query language for selecting nodes from an XML document. querySelectorAll('#ID') //returns node list, you may need to use forEach To select by class: Feb 21, 2025 · Text content selection. locator to create a locator that takes a selector describing how to find an element in the page Jul 9, 2015 · There have been couple of recent posts asking about using KM to click on particular elements on web pages. Here is the HTML for the examples. querySelectorAll() Returns a NodeList containing all matching Element nodes within the node's subtree, or an empty NodeList if no matches are found. Playwright comes with UI Mode , where you can easily walk through each step of the test, see logs, errors, network requests, inspect the DOM snapshot and more. If wanted we can also use XPath directly in CSS selectors such as in QuerySelector or QuerySelectorAll calls. querySelectorAll() //for multiple nodes To select by ID: document. XPath namespace. Using this you can access multi level of shadow DOM (up to 4 levels). prototype. CSS Selector is purely based on the design of the application, the availability of the attributes in the DOM tree, and the complexity of the element structure. querySelector and document. log(element); // This will log the element to the console. Figure 4: The comparison and validation of the XPath vs querySelector for shadow DOM. CSS selector guide, you explored the two most popular HTML query languages. You started from the basics and then learned about their syntax and capabilities. You can use XPath axes like ancestor, descendant, following-sibling etc to select elements based on their position in the document. Apr 9, 2025 · If the provided context node is not a type permitted as an XPath context node or the request type is not permitted by the XPathEvaluator, a DOMException of type NOT_SUPPORTED_ERR is raised. querySelectorAll('*')). const element = await page Nov 28, 2018 · 从接口定义可以看到Document、DocumentFragment、Element都实现了NodeSelector接口。 即这三种类型的元素都拥有者两个方法。 querySelector和querySelectorAll的参数须是符合css selector的字符串。 Both are extension methods defined in the AngleSharp. The web is a dynamic environment, and writing scripts that are still likely to work in a few months (or years) takes some practice. Aug 3, 2021 · As you can see, XPath expressions have capabilities beyond CSS selectors. Finding elements based on their XPath expression generally works very well and is flexible. 그래서 자연스럽게 CSS Selector에 익숙해져 있었는데, Selenium과 Scrapy를 접하면서 XPATH를 사용하는 예제들이 많이 보였고 자연스럽게 XPATH에 대해서 알아보고 사용하게 되었다. If no matching node is found, null is returned. evaluate() returns an XPathResult based on an XPath expression and other given parameters. These functions can be used to perform calculations and extract specific information from the elements. Jan 23, 2014 · So, it turns out that the querySelectorAll method doesn't actually support XPath. XPath on the other hand, was specifically designed to provide a query language for XML documents and comes with a wide range of built-in functions. You can pass a queryOptions object with the query type. If you absolutely must use CSS or XPath locators, you can use page. querySelector('#ID') //returns single element document. getElementById() vs document. But there are already some research about this. XPath snippets. Jul 22, 2020 · It’s called XPath, and here’s how to use it. highlight”) let p_text = p_tag. queryselector xpath When to use XPath expressions. Generally, more specific xpath selectors, as in the above example, usually give a significant performance improvement, especially on very large documents. Selecting via textDocument isn't good because there are many spans with the same textDocument. CSS Selector. com. This flexibility Oct 2, 2024 · XPath can help you pull specific information from websites. You can use XPath to find elements by their id, tag name, class name, and other attributes. 0 and later versions of XPath (2. querySelector样式选择器进行html解析(三):实现样式选择 Apr 14, 2025 · See the description of the translate function in the XPath specification for complete information about this function and its parameters. XPath Cheat Sheet illustration What is XPath? XPath stands for XML Path Language, a tool used to navigate through elements and attributes in an XML document. Apr 6, 2023 · 使用xpath实现document. Comparing this with the Copy selector option, which provides a CSS selector, can help you understand the differences between using XPath and CSS selectors. Examples The following example shows the use of the evaluate() method. How XPath expressions and CSS selectors compare when it comes to performance, simplicity, and use cases. a > :nth-child(2) + *'); But they both skips it and returns only the "p" element. Utilizing Xpath for selection Jan 26, 2024 · 3. Most developers quickly learn about the querySelector and querySelectorAll methods for querying the DOM with CSS selectors. are you doing manual walking or using querySelector? – Raynos. querySelectorAll ('a')] but if you need to target deeply In this tutorial, we will provide an in-depth comparison of XPath vs CSS selector to help testers make an informed decision. Mar 22, 2025 · Advantages of Using XPath. List elements implement Selector interface too. Feb 5, 2025 · This article seeks to document the difference between CSS Selectors and XPath for web developers to be able to better choose the right tool for the right job. querySelector("xpath=//h2") Nov 19, 2019 · 처음 python으로 크롤러를 만들때 requests와 bs4를 사용하였는데, bs4에는 XPATH에 대한 개념이 존재하지않았다. querySelector('CSS-PATH-FROM-DEVTOOL'); myEl. Puppeteer can be used to get an element by XPath. Feb 5, 2025 · This document describes the interface for using XPath in JavaScript. Mar 20, 2023 · Hello, As my case. The querySelector() method returns the first element that matches a CSS selector. js, you can debug it with your debugger of choice e. To return all matches (not only the first), use the querySelectorAll() instead. 1Selector 选择器,也就是通常说的元素定位了 ,常用的有四种。 1. CSS. The querySelector() is a method of the Element interface. The Document getElementsByClassName() Method Feb 5, 2025 · The main interface to using XPath is the evaluate function of the document object. It's often faster than XPath when selecting elements because it leverages the browser's native CSS engine, which is optimized for parsing and matching. a > :nth-child(3)'); And even by using next sibling: document. For example: Oct 22, 2017 · Most of the time, I prefer document. The path part of XPath means that we need to specify the path from the beginning to the desired element. How to use XPath Expressions in JavaScript. What are XPath selectors? XPath, or XMLPath, is a query language that uses non-XML XPath provides a wider range of options to target elements than CSS selectors. XPath queries are mainly made using the Document class’s Evaluate() method. querySelector('CSS-SELECTOR-FROM-DEVTOOL'); myEl. It helps in writing much better, readable and maintainable code. Setting the value of outerHTML replaces the element and all of its descendants with a new DOM tree constructed by parsing the specified htmlString. Xpath is easily extendable with additional functionality. 开头的,判断为xpath. Locating elements with XPath works very well with a lot of flexibility. We pass the XPath as the argument, and the method returns the first element that matches the XPath. I want to select an element that has "Hello World!" literally anywhere in its code. Apr 14, 2019 · I'm writing also a utility function to either use querySelector or xpath, and need to differenciate the 2. Between CSS, text and aria selectors, the use case for XPath should be very narrow nowadays. slice. Jan 31, 2020 · 选择器 描述 [用于选取带有指定属性的元素。 [attribute=value]用于选取带有指定属性和值的元素。 [attribute~=value]用于选取属性值中包含指定词汇的元素。 So, you can simply go for the CSS selectors. XPath vs. querySelector(“p. g. Considering the above scenario, you can see that choosing XPath vs. I want to know I can using document. match(regEx Dec 25, 2021 · For the sake of demonstration, we configured one test using the xpath locator and another using the querySelector. XPath allows you to navigate up the DOM when looking for elements to test or scrape. Traversing the DOM in older browsers like IE8 does not work with cssSelector but is fine with XPath. byRole API. Ninguno de ellos menciona casos específicos. Automation tools rely on locators to find almost every component or element on the webpage. The method returns an XPathResult based on the provided XPath expression and the supplied parameters. W3Schools offers free online tutorials, references and exercises in all the major languages of the web. 试着用这样的东西:var text = document. Targeting with XPath vs CSS. 이 포스트는 사용 Jul 7, 2023 · This interface is a compiled XPath expression that can be evaluated on a document or specific node to return information from its DOM tree. It’s compatible with old browsers (or it was at time of publishing—including older versions of Internet Explorer, which some corporations still use). querySelector() vs document. querySelector (from document) vs parent. Aquí hay algunas cosas con las que podría empezar. querySelector (v22) Revision 22 of this benchmark created on October 23, 2012. Console to present all titles: Dec 30, 2015 · 2. For Sep 19, 2024 · 在JavaScript中,可以通过多种方式来获取包含某个特定文本的元素,如使用querySelector、遍历DOM、使用XPath等方法。以下是几种常见的方法:使用querySelector、遍历DOM、使用XPath。 一种常见的方法是使用JavaScript的querySelectorAll方法,然后通过遍历这些… Mar 15, 2024 · Right-click on the element code and select Copy → Copy XPath or Copy full XPath,allowing you to obtain an element's XPath. HTML Overview Oct 12, 2020 · What is the easiest way to validate XPath / CSS selectors? Most of the browsers provide a built-in developer tools, which includes a handy feature that can evaluate or validate XPath/CSS selectors without any third-party extensions: browser console. "Increasing page size" - my Sep 5, 2017 · let myEl = document. locator to create a locator that takes a selector describing how to find an element in the page. If no matches are found, null is returned. For example, XPath expressions can find an element based on its text content. The querySelector() method allows you to select the first element that matches one or more CSS selectors. Luckily, most programming languages support both and when web scraping we're best to mix these two technologies! その場合はCSSセレクタではなくXPathのほうが便利。 ちょっとコツが要るが、「クラス名がc-paging__pagenavi-itemのテキストが">"というアンカーをクリックしなさい」というソースは以下のスニペットでいける。 Mar 23, 2023 · const xpath = "your_xpath_here"; const element = document. Modern answer that covers XPath 1. The only solution I see here is selecting the previous node and then using nextSibling to access it. querySelector样式选择器进行html解析(三):实现样式选择器. Apr 6, 2023 · 文章浏览阅读2. Can querySelector select text nodes at all? I just wrote this short script; seems to work. ¿Alguien me aclarará alguna comparación de rendimiento integral entre XPath y DOM en diferentes escenarios? He leído algunas preguntas en SO, como xPath vs DOM API, which one has a better performance y XPath or querySelector?. querySelector样式选择器进行html解析(二):扩展一下xpath以便支持正则. 在这篇 XPath 与 CSS 选择器指南中,您将了解到: XPath 表达式是什么、如何工作及其优点和缺点。 CSS 选择器是什么、如何工作及其优缺点。 XPath 表达式与 CSS 选择器在性能、简洁性和使用案例方面的比较。 现在开始深入了解吧! XPath:全面分析 querySelector() 方法返回文档中匹配指定 CSS 选择器的一个元素。 注意: querySelector() 方法仅仅返回匹配指定选择器的第一个元素。如果你需要返回所有的元素,请使用 querySelectorAll() 方法替代。 return root. This makes XPath Apr 18, 2025 · They represent a way to find element(s) on the page at any moment. Dec 26, 2023 · XPath is a powerful tool for finding elements in a DOM. querySelector() > FASTER > document. May 17, 2024 · Relative XPath: Relative XPath is more flexible and resilient to changes in the document structure. GetElement Methods: The Document getElementById() Method. evaluate() Sep 25, 2024 · 使用JavaScript根据文本内容定位标签的方法有很多,包括 querySelector、getElementsByClassName、getElementsByTagName 以及 XPath 等。 使用 querySelector、innerText 结合正则表达式、结合 XPath 定位特定文本内容、遍历 DOM 树来查找文本内容。 I think main advantage of XPath is its ability to go UP the tree structure of DOM. getElementsByClassName (from an element) document. XPath vs CSS selector for Test Automation May 8, 2016 · Document. For example, you need to select the button (in order to simulate click on it) which is placed inside some container without any attrubites (class attribute or whatever) and the only thing you Apr 18, 2025 · Locate by CSS or XPath. These functions are based on standard interfaces from the DOM Level 3 XPath specification that expose XPath functionality to JavaScript code Since Playwright runs in Node. querySelector(selector);}, // Returns all elements matching given selector in the root's subtree. querySelector样式选择器进行html解析(二):扩展一下xpath以便支持正则使用xpath实现document. bydy ioguw kqzdakd fzo vtfyw gzvbjqn cffm dtnw vfondzf daprq fbyz fszzrre vvonm wfpqj nilba