diff --git a/examples/quickstart.py b/examples/quickstart.py index 3253805..e4d031b 100644 --- a/examples/quickstart.py +++ b/examples/quickstart.py @@ -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):