From c962e2116305d41a05986a54560bc46da268e5e1 Mon Sep 17 00:00:00 2001 From: g1879 Date: Mon, 10 Aug 2020 10:55:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Deles=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DrissionPage/driver_element.py | 4 ++-- DrissionPage/driver_page.py | 4 ++-- DrissionPage/session_element.py | 2 +- DrissionPage/session_page.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/DrissionPage/driver_element.py b/DrissionPage/driver_element.py index a51eca1..b39fcdc 100644 --- a/DrissionPage/driver_element.py +++ b/DrissionPage/driver_element.py @@ -14,7 +14,7 @@ from selenium.webdriver.remote.webelement import WebElement from selenium.webdriver.support import expected_conditions as ec from selenium.webdriver.support.wait import WebDriverWait -from .common import DrissionElement, get_loc_from_str, translate_loc_to_xpath, get_available_file_name +from .common import DrissionElement, get_loc_from_str, get_available_file_name class DriverElement(DrissionElement): @@ -196,7 +196,7 @@ class DriverElement(DrissionElement): :param show_errmsg: 出现异常时是否打印信息 :return: DriverElement对象组成的列表 """ - if not isinstance(loc_or_str, tuple) or not isinstance(loc_or_str, str): + if not isinstance(loc_or_str, tuple) and not isinstance(loc_or_str, str): raise TypeError('Type of loc_or_str can only be tuple or str.') return self.ele(loc_or_str, mode='all', show_errmsg=show_errmsg, timeout=timeout) diff --git a/DrissionPage/driver_page.py b/DrissionPage/driver_page.py index a6a3871..4a8a436 100644 --- a/DrissionPage/driver_page.py +++ b/DrissionPage/driver_page.py @@ -14,7 +14,7 @@ from selenium.common.exceptions import NoAlertPresentException from selenium.webdriver.chrome.webdriver import WebDriver from selenium.webdriver.remote.webelement import WebElement -from .common import get_loc_from_str, get_available_file_name, translate_loc_to_xpath +from .common import get_loc_from_str, get_available_file_name from .driver_element import DriverElement, execute_driver_find @@ -147,7 +147,7 @@ class DriverPage(object): :param show_errmsg: 出现异常时是否打印信息 :return: DriverElement对象组成的列表 """ - if not isinstance(loc_or_str, tuple) or not isinstance(loc_or_str, str): + if not isinstance(loc_or_str, tuple) and not isinstance(loc_or_str, str): raise TypeError('Type of loc_or_str can only be tuple or str.') return self.ele(loc_or_str, mode='all', timeout=timeout, show_errmsg=show_errmsg) diff --git a/DrissionPage/session_element.py b/DrissionPage/session_element.py index ac3ecb3..1fe8ee6 100644 --- a/DrissionPage/session_element.py +++ b/DrissionPage/session_element.py @@ -167,7 +167,7 @@ class SessionElement(DrissionElement): :param show_errmsg: 出现异常时是否打印信息 :return: SessionElement对象组成的列表 """ - if not isinstance(loc_or_str, tuple) or not isinstance(loc_or_str, str): + if not isinstance(loc_or_str, tuple) and not isinstance(loc_or_str, str): raise TypeError('Type of loc_or_str can only be tuple or str.') return self.ele(loc_or_str, mode='all', show_errmsg=show_errmsg) diff --git a/DrissionPage/session_page.py b/DrissionPage/session_page.py index 6845614..f801741 100644 --- a/DrissionPage/session_page.py +++ b/DrissionPage/session_page.py @@ -133,7 +133,7 @@ class SessionPage(object): :param show_errmsg: 出现异常时是否打印信息 :return: SessionElement对象组成的列表 """ - if not isinstance(loc_or_str, tuple) or not isinstance(loc_or_str, str): + if not isinstance(loc_or_str, tuple) and not isinstance(loc_or_str, str): raise TypeError('Type of loc_or_str can only be tuple or str.') return self.ele(loc_or_str, mode='all', show_errmsg=True)