修复获取before的一个小问题

This commit is contained in:
g1879 2022-01-28 10:51:05 +08:00
parent 455f805eba
commit e603a9d38c
2 changed files with 3 additions and 2 deletions

View File

@ -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:

View File

@ -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.",