改进input()

This commit is contained in:
g1879 2021-12-04 08:02:40 +08:00
parent 6bd2f8bb28
commit bf34208bed
2 changed files with 2 additions and 3 deletions

View File

@ -359,11 +359,10 @@ class DriverElement(DrissionElement):
full_txt = full_txt.rstrip('\n') full_txt = full_txt.rstrip('\n')
self.click(by_js=True) self.click(by_js=True)
from selenium.webdriver import Keys
t1 = perf_counter() t1 = perf_counter()
while self.is_valid() and self.attr('value') != full_txt and perf_counter() - t1 <= self.page.timeout: while self.is_valid() and self.attr('value') != full_txt and perf_counter() - t1 <= self.page.timeout:
if clear: if clear:
self.inner_ele.send_keys(Keys.CONTROL, 'a', Keys.DELETE) # 有些ui下clear()不生效 self.inner_ele.send_keys(u'\ue009', 'a', u'\ue017') # 有些ui下clear()不生效用CTRL+a代替
self.inner_ele.send_keys(vals) self.inner_ele.send_keys(vals)
if enter: if enter:

View File

@ -6,7 +6,7 @@ with open("README.md", "r", encoding='utf-8') as fh:
setup( setup(
name="DrissionPage", name="DrissionPage",
version="2.0.0", version="2.0.3",
author="g1879", author="g1879",
author_email="g1879@qq.com", author_email="g1879@qq.com",
description="A module that integrates selenium and requests session, encapsulates common page operations.", description="A module that integrates selenium and requests session, encapsulates common page operations.",