diff --git a/DrissionPage/base.py b/DrissionPage/base.py index 6ce74cc..ab34bc1 100644 --- a/DrissionPage/base.py +++ b/DrissionPage/base.py @@ -264,8 +264,9 @@ class DrissionElement(BaseElement): nodes = [e for e in nodes if not (isinstance(e, str) and sub('[ \n\t\r]', '', e) == '')] if nodes and index is not None: + index = index - 1 if direction == 'following' else -index try: - return [nodes[index - 1]] + return [nodes[index]] except IndexError: return [] else: diff --git a/setup.py b/setup.py index 056bf37..30f0dc2 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ with open("README.md", "r", encoding='utf-8') as fh: setup( name="DrissionPage", - version="2.4.2", + version="2.4.3", author="g1879", author_email="g1879@qq.com", description="A module that integrates selenium and requests session, encapsulates common page operations.",