get_next_source
This commit is contained in:
parent
a83ee7f81c
commit
5a0b666e65
@ -1,5 +1,5 @@
|
||||
# imports we'll use in this example
|
||||
from spatula import HtmlPage, HtmlListPage, CSS, XPath
|
||||
from spatula import HtmlPage, HtmlListPage, CSS, XPath, SelectorError
|
||||
|
||||
|
||||
class EmployeeList(HtmlListPage):
|
||||
@ -24,6 +24,12 @@ class EmployeeList(HtmlListPage):
|
||||
source=XPath("./a/@href").match_one(details),
|
||||
)
|
||||
|
||||
def get_next_source(self):
|
||||
try:
|
||||
return XPath("//a[contains(text(), 'Next')]/@href").match_one(self.root)
|
||||
except SelectorError:
|
||||
pass
|
||||
|
||||
|
||||
class EmployeeDetail(HtmlPage):
|
||||
def process_page(self):
|
||||
|
Loading…
Reference in New Issue
Block a user