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)