From e241649a1d8782a9a295ec256e435ea732efcbfe Mon Sep 17 00:00:00 2001 From: g1879 Date: Thu, 20 Apr 2023 11:40:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A8=E4=BD=9C=E9=93=BE=E7=9A=84type()?= =?UTF-8?q?=E5=8F=AF=E6=8E=A5=E6=94=B6list=E5=92=8Ctuple?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DrissionPage/action_chains.py | 9 +++++---- DrissionPage/action_chains.pyi | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/DrissionPage/action_chains.py b/DrissionPage/action_chains.py index 0cb0c6e..b9edcaa 100644 --- a/DrissionPage/action_chains.py +++ b/DrissionPage/action_chains.py @@ -252,13 +252,14 @@ class ActionChains: def type(self, text): """输入文本 - :param text: 要输入的文本 + :param text: 要输入的文本,特殊字符和多个文本可用list或tuple传入 :return: self """ for i in text: - self.key_down(i) - sleep(.05) - self.key_up(i) + for character in i: + self.key_down(character) + sleep(.05) + self.key_up(character) return self def wait(self, second): diff --git a/DrissionPage/action_chains.pyi b/DrissionPage/action_chains.pyi index da4d558..3b54a49 100644 --- a/DrissionPage/action_chains.pyi +++ b/DrissionPage/action_chains.pyi @@ -65,7 +65,7 @@ class ActionChains: def key_up(self, key: str) -> ActionChains: ... - def type(self, text: str) -> ActionChains: ... + def type(self, text: Union[str, list, tuple]) -> ActionChains: ... def wait(self, second: float) -> ActionChains: ...