Original: Http://ejohn.org/blog/xpath-css-selectors
Lately, I've done a lot of work to implement a parser that supports both XPath and CSS 3, and what surprises me is that they are very similar in some ways, but in other ways they are
First, select the nodeCommon Road-strength Expressions:
An expression
Describe
Instance
NodeName
Select all child nodes of the NodeName node
XPath ('//div ')
All child nodes of a div node
First, select the nodeCommon Road-strength Expressions:
An expression
Describe
Instance
NodeName
Select all child nodes of the NodeName node
XPath ('//div ')
All child nodes of a div node
The XPath that was misused in the seleniumIn the process of automating testing with selenium, it is a common task to select the elements on the page and perform various operations on them. Selenium offers a variety of positioning methods:
In selenium automation, if the ID, class, name, etc General Locator cannot find the element, the XPath is used to find the element on the Web page.This time I will explain from the following three aspects:1. What is XPath2. Use of XPath syntax3. Use
Reading Catalog 1.HtmlAgilityPack Introduction 2.XPath Technology Introduction and Usage 3. Weather Collection Case 4. Resources
The first contact Htmlagilitypack was 5 years ago, some accidents, let me from the technical department temporarily
Readers may wonder what my title looks like, mostly just write lxml and bs4 the two PY module names may not be able to attract the attention of the public, generally speaking of web page parsing technology, referring to the keywords are more
1: By ID2: By name3: Through XPath3.1 Through the absolute path of the XPath, from the outermost start to findsuch as/html/body/div[1]/div[4]/div[2]/div/form/span[1]/input3.2 Relative paths through XPath3.2.1 FindElementsItselfXPath can also take
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.