From e603a9d38cc0a70a4370576b3366b0a589979d89 Mon Sep 17 00:00:00 2001 From: g1879 Date: Fri, 28 Jan 2022 10:51:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=8E=B7=E5=8F=96before?= =?UTF-8?q?=E7=9A=84=E4=B8=80=E4=B8=AA=E5=B0=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DrissionPage/base.py | 3 ++- setup.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) 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.",