Skip to content

Commit

Permalink
document chaining.
Browse files Browse the repository at this point in the history
  • Loading branch information
realtimeprojects committed Sep 6, 2023
1 parent f66ea00 commit 98a9fa8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,15 @@ Create the most simple xpath for a `div` element:
from yaxp import xpath

# //div
xpath.div()
xpath.div
```

xpath objects are chainable:

``` python
# //div//h1
xpath.div.h1

Any keyword argument you pass will add a filter for an
attribute with the name and value of the keyword:

Expand Down
1 change: 1 addition & 0 deletions tests/test_xpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
testdata = [
# basic xpath
(xp.h1, '//h1'),
(xp.div.h1, '//div//h1'),

# full class specification
(xp.h2.by(_id="huhu"), '//h2[@id="huhu"]'),
Expand Down

0 comments on commit 98a9fa8

Please sign in to comment.